.NET 4.0 introduced the System.Collections.Concurrent namespace:
"The System.Collections.Concurrent namespace provides several thread-safe collection classes that should be used in place of the corresponding types in the System.Collections and System.Collections.Generic namespaces whenever multiple threads are accessing the collection concurrently"
BlockingCollection<T>
classConcurrentBag<T>
classConcurrentQueue<T>
classConcurrentDictionary<TKey, TValue>
classOrderablePartitioner<TSource>
classPartitioner
classIProducerConsumerCollection<T>
interface
The SynchronizedCollection<T>
class (available since .NET 3.0):
"Provides a thread-safe collection that contains objects of a type specified by the generic parameter as elements"
...is in the System.Collections.Generic
namespace.
So, why is the SynchronizedCollection<T>
class thread-safe but not concurrent?
What specifically makes the SynchronizedCollection<T>
generic class different and incompatible with collections from those in System.Collections.Concurrent
?
Update:
Let me rephrase the question:
What is the common denominator and distinguishing new feature in all generic collections that belong to the System.Collections.Concurrent
namespace, which is absent in (and impossible while using) the SynchronizedCollection<T>
generic class?
I changed the title to "What .NET 4.0 System.Collections.Concurrent
collection added in functionality to .NET 3.0 SynchronizedCollection
?".
But mostly I am interested to know what it is that made it impossible to do on the basis of .NET 3.0
Update2: Concerning the note:
"This question may already have an answer here:
What is the difference between SynchronizedCollection and the other concurrent collections?"
The answer is confusing in context of my question - are the new features evolutionary (using pre-.NET 4.0 features) or revolutionary (unavailable in pre-.NET 4.0)?