Maximum capacity collection in c#

前端 未结 9 2023
Happy的楠姐
Happy的楠姐 2020-12-09 04:27

In the .Net BCL is there a collection data structure similar to list that has a maximum capacity, say configured to 100 items, which when item 101 is added the original firs

9条回答
  •  生来不讨喜
    2020-12-09 05:17

    You could inherit from whatever existing collection was most appropriate (Stack, Dequeue, List, CollectionBase, etc.) and implement this feature yourself. Just override or replace the Add() method.

提交回复
热议问题