Is there any way to limit the size of a generic collection?
I have a Stack of WriteableBitmap which I am using to store a clone of a WriteableBitmap on each change,
You have to implement your own wrapper to achieve that. There is no direct option available.
class FixedSizeStack : Stack { private int MaxNumber; public FixedSizeStack(int Limit) : base() { MaxNumber = Limit; } public override void Push(object obj) { if (this.Count < MaxNumber) base.Push(obj); } }