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())
Just take out all remaining items:
while (collection.TryTake(out _)){}