Generic SortedList Collection in C#

The following code sample creates a generic SortedList using strings as the keys and integers as the values.

SortedList<string, int> sl = new SortedList<string,int>();
sl.Add("One", 1);
sl.Add("Two", 2);
sl.Add("Three", 3);
foreach (int i in sl.Values)
Console.WriteLine(i.ToString());

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.