I have a thread adding items to a BlockingCollection .
BlockingCollection
On another thread I am using foreach (var item in myCollection.GetConsumingEnumerable())
foreach (var item in myCollection.GetConsumingEnumerable())
For just clearing the collection you can do:
myBlockingCollection.TakeWhile<*MyObject*>(qItem => qItem != null);
or just
myBlockingCollection.TakeWhile<*MyObject*>(qItem => true);