Represents a collection of associated keys and values, which are sorted by the keys and are accessible both by key and by index.
Object
SortedList
[Visual Basic] Public Class SortedList Implements IDictionary, ICollection, IEnumerable, ICloneable [C#] public class SortedList : IDictionary, ICollection, IEnumerable, ICloneable [C++] public __gc class SortedList : public IDictionary, ICollection, IEnumerable, ICloneable [JScript] public class SortedList implements IDictionary, ICollection, IEnumerable, ICloneable
A SortedList internally maintains two arrays to store the entries to the list-- one array for the keys and another array for the associated values. An entry is a key-and-value pair.
The capacity of a SortedList is the number of entries that the list can hold. As elements are added to a SortedList, the capacity is automatically increased as required through reallocation. The capacity can be decreased by calling TrimToSize or by setting the Capacity property explicitly.
The keys of a SortedList can be sorted either according to a specific IComparer implementation specified when the SortedList is instantiated, or according to the IComparable implementation provided by the keys themselves. In either case, a SortedList does not allow duplicate keys.
a null reference (in Visual Basic Nothing) is not allowed as a key, but is allowed as a value.
Namespace: System.Collections
Assembly: mscorlib.dll
SortedList Members | System.Collections Namespace | IComparable | IComparer | IDictionary | Dictionary | Hashtable