I need a concurrent collection that doesn't allow duplicates (to use in BlockingCollection
as Producer/Consumer).
I don't need strict order of elements.
From another hand i want to minimize the maximum time of element "live" in collection. I.e. collection mustn't be LIFO, ideally it should be FIFO.
Well I would say that I need ConcurrentQueue
with no duplicates allowed, but ConcurrentBag
with no duplicates also might work.
Why C# doesn't contain anything like that and probably someone already created it?
This question is result of my previous question What type of IProducerConsumerCollection<T> to use for my task?