.net 4.0 concurrent queue dictionary
- by freddy smith
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?