Get the value List in a SortedList in CSharp
Description
The following code shows how to get the value List in a SortedList.
Example
using System;// w w w. ja v a 2 s .c om
using System.Collections;
class MainClass
{
public static void Main()
{
SortedList mySortedList = new SortedList();
mySortedList.Add("NY", "New York");
mySortedList.Add("FL", "Florida");
mySortedList.Add("AL", "Alabama");
mySortedList.Add("WY", "Wyoming");
mySortedList.Add("CA", "California");
IList myValueList = mySortedList.GetValueList();
foreach(string myValue in myValueList)
{
Console.WriteLine("myValue = " + myValue);
}
}
}
The code above generates the following result.