.net 4.0 concurrent queue dictionary

Posted by freddy smith on Stack Overflow See other posts from Stack Overflow or by freddy smith
Published on 2010-05-31T09:28:35Z Indexed on 2010/05/31 9:32 UTC
Read the original article Hit count: 361

Filed under:
|
|
|
|

I would like to use the new concurrent collections in .NET 4.0 to solve the following problem.

The basic data structure I want to have is a producer consumer queue, there will be a single consumer and multiple producers.

There are items of type A,B,C,D,E that will be added to this queue. Items of type A,B,C are added to the queue in the normal manner and processed in order.

However items of type D or E can only exist in the queue zero or once. If one of these is to be added and there already exists another of the same type that has not yet been processed then this should update that other one in-place in the queue. The queue position would not change (i.e. would not go to the back of the queue) after the update.

Which .NET 4.0 classes would be best for this?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .net-4.0