> How do I modify the value of a dictionary object?
>
[quoted text clipped - 20 lines]
> The only way I know to do it is remove the key and then re-add it with the
> new value... but surely there is a better way?
No - or at least not without a bit of jiggery-pokery with interfaces.
But then it's a bad idea to make the struct mutable in the first place.
This is just one of the places where mutable structs are painful. Avoid
them, avoid them, avoid them.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Jon Slaughter - 17 Mar 2008 21:50 GMT
>> How do I modify the value of a dictionary object?
>>
[quoted text clipped - 26 lines]
> This is just one of the places where mutable structs are painful. Avoid
> them, avoid them, avoid them.
I moved on to a keyed collection. Thats actually what I originally wanted
but didn't know it existed. (a little easier than using a dictionary because
my value was a struct in the first place).
I changed the struct to a class though so I can easily modify the values.
Thanks,
Jon