Brans Ds
Brans Ds

Reputation: 4117

The effective synchronized collection for a few producers and one consumer

What would be the most effective synchronized collection in .net for few producers (threads) and one consumer? Producing is much faster than consuming. Ordering is required.

Would it be just default BlockingCollection on ConcurrentQueue?

Upvotes: 0

Views: 84

Answers (1)

Sriram Sakthivel
Sriram Sakthivel

Reputation: 73502

By default BlockingCollection wraps ConcurrentQueue when you didn't specify IProducerConsumerCollection<T> in its constructor.

So whatever you choose to use is pretty same thing. With BlockingCollection you get advantage of GetConsumingEnumerable method which is deigned for consumer.

Upvotes: 1

Related Questions