Hashtable and Dictionary thread safety considerations

Let’s start with the basics: System.Collections.Hashtable is multiple-reader, single-writer threadsafe. System.Collections.Generic.Dictionary<K,V> has no thread safety guarantees. Consider a class that has a Dictionary member, and assume that multiple threads may access it simultaneously. Taking a lock is expensive, so what do you think about the following attempt to defer taking a lock? class ElementManager {…

1