I would like to use the new parallel collections in .NET 4.0 to solve the following problem.
The main data structure that I want to have is the turn of consumer producers, there will be one consumer and several manufacturers.
There are items like A, B, C, D, E that will be added to this queue. Elements of type A, B, C are added to the queue in the usual way and processed in order.
However, elements of type D or E can only exist in the queue zero or once. If one of them needs to be added, and another already exists of the same type that has not yet been processed, this should update this other place in the queue. After the update, the position of the queue will not change (that is, it will not return to the queue).
What .NET 4.0 classes are best suited for this?
source
share