June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to use a collection that is automatically sorted every time an item is added or removed.
Use the System.Collections.SortedList type, which sorts items based on the key.
The SortedList class is a key-based dictionary collection that stores items in a perpetually ordered state. That makes it slower when adding or removing items. However, using a SortedList collection is usually faster than continuously resorting an Array or ArrayList. Behind the scenes, a sorted list uses two arrays: one to store key values, and one to store the data itself (or the object reference).
The most important aspect to understand about the SortedList class is that it orders items based on the key value, not the object itself. ...
Read now
Unlock full access