Best way to implement a List(Of) with a maximum number of items
- by Ben
I'm trying to figure out a good way of implementing a List(Of) that holds a maximum number of records.
e.g.
I have a List(Of Int32) - it's being populated every 2 seconds with a new Int32 item.
I want to store only the most current 2000 items.
How can I make the list hold a maximum of 2000 items, then when the 2001'th item is attempted to be added, the List drops the 2000'th item (resulting in the current total being 1999).
Thing is, I need to make sure I'm dropping only the oldest item and adding a new item into the List.
Ben