C# SortedList SortedList(IDictionary)
Description
SortedList SortedList(IDictionary)
initializes a
new instance of the SortedList class that contains elements copied from
the specified dictionary, has the same initial capacity as the number of
elements copied, and is sorted according to the IComparable interface implemented
by each key.
Syntax
SortedList.SortedList(IDictionary)
has the following syntax.
public SortedList(
IDictionary d
)
Parameters
SortedList.SortedList(IDictionary)
has the following parameters.
d
- The IDictionary implementation to copy to a new SortedList object.
Example
using System;//from w w w.jav a2 s. co m
using System.Collections;
using System.Globalization;
public class SamplesSortedList
{
public static void Main()
{
Hashtable myHT = new Hashtable();
myHT.Add("FIRST", "Hello");
myHT.Add("SECOND", "World");
myHT.Add("THIRD", "!");
SortedList mySL1 = new SortedList(myHT);
}
}
The code above generates the following result.