using System;
using System.Collections;
Code:
static void Main(string[] args)
{
values in sorted list are sorted according to key
SortedList myList = new SortedList();
myList.Add(12, "December");
myList.Add(9, "September");
myList.Add(10, "October");
myList.Add(4, "April");
myList.Add(5, "May");
myList.Add(6, "June");
myList.Add(2, "February");
myList.Add(8, "August");
myList.Add(7, "July");
myList.Add(3, "March");
myList.Add(11, "November");
myList.Add(1, "January");
output values that are sorted according to key
foreach (DictionaryEntry item in myList)
{
Console.WriteLine(item.Value);
}
}
0 comments:
Post a Comment