ConcurrenctBag(Of MyType) Vs List(Of MyType)
- by Ben
What is the advantage of using a ConcurrentBag(Of MyType) against just using a List(Of MyType)?
The MSDN page on the CB (http://msdn.microsoft.com/en-us/library/dd381779(v=VS.100).aspx) states that
ConcurrentBag(Of T) is a thread-safe
bag implementation, optimized for
scenarios where the same thread will
be both producing and consuming data
stored in the bag
So what is the advantage? I can understand the advantage of the other collection types in the Concurrency namespace, but this one puzzled me.
Thanks.