Mega Code Archive

 
Categories / C# Book / 03 Collections
 

0365 Sub set from SortedSet

Obtain the letters between f and j using System; using System.Collections; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Collections.Generic; using System.Linq; using System.Reflection; class Program { static void Main() { var letters = new SortedSet<char>("the quick brown fox"); foreach (char c in letters.GetViewBetween('f', 'j')) Console.Write(c); } } The output: fhi