January 2012
Intermediate to advanced
396 pages
8h 16m
English
You have a situation where you want to ensure thread safety for your collection, but you don't care for the order of insertion, or in other words, you don't care whether it is a FIFO or a LIFO list. The elements in the collection can be in any order. In this situation, you need a vanilla implementation of the IProducerConsumerCollection<T> interface and that is BlockingCollection<T>, the wrapper collection of IProducerConsumerCollection<T>. All others except ConcurrentDictionary also implement IProducerConsumerCollection<T>.
There is another situation where BlockingCollection<T> can prove to be extremely handy. While waiting on some producer tasks to generate results and then iterate over them, ...
Read now
Unlock full access