NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

SortedList Constructor (IDictionary)

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
);

Parameters

d
The IDictionary to copy into a new SortedList.

Exceptions

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.

Remarks

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.

See Also

SortedList Class | SortedList Members | System.Collections Namespace | SortedList Constructor Overload List | IDictionary | IComparable | Dictionary | Hashtable | Capacity