CSharp examples for LINQ:order by
Ordering the groups
using System;//from www . ja v a 2 s . c o m using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { string[] names = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; var wordGroups = from n in names orderby n[0] group n by n[0]; foreach (var letterGroup in wordGroups) { Console.WriteLine("\t\tWords that begin with '{0}': ", letterGroup.Key); foreach (var word in letterGroup) { Console.WriteLine("\t\t\t{0}", word); } } } }