Get an enumerator that iterates through the SortedSet in CSharp
Description
The following code shows how to get an enumerator that iterates through the SortedSet.
Example
using System;//from ww w . jav a2 s .c o m
using System.Collections;
using System.Collections.Generic;
using System.IO;
class Program
{
static void Main(string[] args)
{
SortedSet<string> set1 = new SortedSet<string>();
set1.Add("a");
set1.Add("b");
set1.Add("d");
set1.Add("d");
IEnumerator e = set1.GetEnumerator();
while (e.MoveNext())
{
Object obj = e.Current;
Console.WriteLine(obj);
}
}
}
The code above generates the following result.