Copies the entries from a dictionary to a new SortedList, sorted according to the IComparable interface implemented by each key.
[Visual Basic] Overloads Public Sub New( _ ByVal d As IDictionary _ ) [C#] public SortedList( IDictionary d ); [C++] public: SortedList( IDictionary* d ); [JScript] public function SortedList( d : IDictionary );
Exception Type | Condition |
---|---|
ArgumentNullException | d is a null reference (in Visual Basic Nothing). |
InvalidCastException | One or more elements in d do not implement the IComparable interface. |
When adding elements to the list and the number of elements exceeds the capacity, the capacity is doubled.
The elements are sorted according to the IComparable implementation of each key added to the SortedList.
A Hashtable is an example of a Dictionary that can be passed to this constructor. The new SortedList will contain a copy of the keys and values stored in the Hashtable.
SortedList Class | SortedList Members | System.Collections Namespace | SortedList Constructor Overload List | IDictionary | IComparable | Dictionary | Hashtable | Capacity