This documentation is archived and is not being maintained.

SortedList Collection Type

The SortedList class is like a hybrid between Hashtable and ArrayList.

As with Hashtable, SortedList is based on the IDictionary interface; therefore, each element of a SortedList is a key-and-value pair. SortedList provides methods that return only the list of keys or only the list of values.

As with ArrayList, a SortedList is a sequence of elements. It is indexed, and is sorted according to a specified comparer.

SortedList is unique among all Collections classes in that each element can be accessed three ways: using the key, the value, or the index.

Use SortedList if you want a collection that holds key-and-value pairs but also need the flexibility of an indexed list.

See Also

Generic Collection Types | SortedList | IDictionary | Hashtable | ArrayList

Show: