Tuesday, June 28, 2011

Working with SortedSet in .NET 4.0

SortedSet is one class that is been added to the .Net class library 4.0 which actually merges the behaviour of HashSet and SortedList together. It maintains the sorted ordering of the list without affecting performance.

Lets see how it works :

SortedSet sorted = new SortedSet { 1, 43, 65, 23, 44, 56, 43, 1, 56, 66, 24 };
 foreach(int number in sorted)
   {
      Console.WriteLine(number);
 }

Console.Read();






Read more: Daily .Net Tips
QR: https://chart.googleapis.com/chart?chs=80x80&cht=qr&choe=UTF-8&chl=http://dailydotnettips.com/2011/06/26/working-with-sortedset-in-net-4-0/