I’m looking for a collection object/strategy that can allow for FIFO and lets me view the items in the collection by simply specifying their position. To clarify:
-
I would like this data structure to hold say 100 DTO objects, and then when it gets to 101, I can make room by deleting the first item, etc. (FIFO).
-
I’d like to be able to return the newest x # of these objects when requested.
I tried to use the .Net queue object, however as far as I can tell it does not support #2, although I might be overlooking something there.
It would not be hard to wrap a List and do a RemoveAt(0) when you want to pop an item out of the queue. That would give you FIFO and let you index in anywhere you want. You should probably wrap it to protect the integrity of the queue (FIFO only).