CSharp examples for LINQ:order by
Ordering words by word length, then by the alphabet
using System;/*w w w. j av 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 sortedNames = from n in names orderby n.Length, n select n; foreach (var name in sortedNames) { Console.WriteLine("\t{0}", name); } } }