Fixed: What's the best way of implementing a thread-safe Dictionary? #solution #programming #development
Fixed: What's the best way of implementing a thread-safe Dictionary? #solution #programming #development
What’s the best way of implementing a thread-safe Dictionary?
I was able to implement a thread-safe Dictionary in C# by deriving from IDictionary and defining a private SyncRoot object:
public class SafeDictionary: IDictionary { private readonly object syncRoot = new object(); private Dictionary d = new Dictionary(); public object SyncRoot { get { return syncRoot; } } public void Add(TKey key,…
View On WordPress















