Limit the size of a generic collection?

后端 未结 4 987
野的像风
野的像风 2020-12-31 18:20

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,

4条回答
  •  离开以前
    2020-12-31 18:57

    You can use LinkedList which represents doubly link list to simulate Circular Stack.

    You can you AddFirst() corresponding to Push(). If Count is 10, you can use RemoveLast().

    For Pop() you can use RemoveFirst()

提交回复
热议问题