I have a class to hold a stack of strings to paint to a UI with which I want to block if there are no items, and take LIFO if there are a lot of items.
internal class PaintStack
{
private BlockingCollection<PaintString> paintStack;
public PaintStack()
{
paintStack = new BlockingCollection<PaintString>(new ConcurrentStack<PaintString>());
}
public void Add(PaintString p)
{
paintStack.Add(p);
}
public PaintString Take()
{
return paintStack.Take();
}
}
When I add
a new object to the collection I am seeing all objects as the same as the new object. What's going on?
New strings come in with price
value of 1450.4
Now the whole concurrent stack has a price of 1450.4
Then next string comes in with price
value of 1460.4
The whole stack appears to have a value of 1460.4
What is going wrong?