By Volume4
via dotnet.dzone.com
Published: Jun 24 2008 / 16:14
In .NET 2.0 and above the SyncRoot was removed from the Dictionary and Hastable classes which meant you can't create thread-safe versions of these anymore. So here I provide a simple implementation of a generic synchronised dictionary class that is thread-safe, this was developed in .NET 3.5 using the new Threading.ReaderWriterLockSlim class.
Comments
isuttle replied ago:
This is great, except for it's not true. Hashtable continues to have SyncRoot, and generic Dictionaries are threadsafe when static/shared.
bigtoe replied ago:
Sorry your sadly mistaken. Generic Dictionaries are not thread safe when declare shared/static.
Voters For This Link (9)
Voters Against This Link (2)