.NET 4 Baby Steps: Part VI - SortedSet
Note: This post is part of a series and you can find the rest of the parts in the series index.
SortedSet
Usage is very simple:
public static void Main()
{
Random random = new Random();
SortedSet<GPSPosition> gpsPositions = new SortedSet<GPSPosition>();
for (int counter = 0; counter < 100000; counter++)
{
gpsPositions.Add(new GPSPosition(random.Next(-180, 181), random.Next(-180, 181)));
}
foreach (GPSPosition position in gpsPositions)
{
Console.WriteLine(position);
}
}
Note: I am using the same GPSPosition class from part IV. This gives the following output:
ISet
Under the surface, SortedSet