In C#, can multiple threads read and write to a Dictionary provided each thread only accesses one element in the dictionary and never accesses another?
No, a Dictionary is not Thread-safe.
With the exception of modifying the contents of a reference type (object) that is stored as the Value in a dictionary.
In .NET 4 we will have System.Collections.Concurrent.ConcurrentDictionary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With