I had a List<myClass> myList
for storing a list of items.
When I had to clip this (discard any amount of items above some threshold) I used:
myList.RemoveRange(threshold, myList.Count - threshold);
where threshold is the max amount of things the list can contain
Now I've upgraded the datatype to a Dictionary<key, myClass> myDictionary
How can I basically do the same: Discard all entries above some threshold. (It doesn't matter which ones are discarded)
I guess I could foreach through the keys collection and manually delete all keys/value pairs. But I was hoping there was a more elegant solution.