Cast from ConcurrentDictionary to IDictionary
.net, c#, concurrency, concurrentdictionary, thread-safety
Solution
The resulting object will still be a concurrent dictionary. The calls like Add or Remove use the underlying implementation TryAdd and TryRemove (which are thread-safe). Casting an object to a different type doesn't change the object itself.
Also, for clarification, you could use tools like ILSpy to see what's the implementation of default IDictionary methods and whether they'll be still thread-safe.
Problem
Does a cast from `ConcurrentDictionary` to `IDictionary` cut off the thread-safe implementation, since `IDictionary` doesn't have `GetOrAdd` and `AddOrUpdate` methods ?