Mega Code Archive

 
Categories / C# / XML LINQ
 

Query string array by its element length

using System; using System.Linq; class HelloWorld {     static void Main() {         string[] words = { "hello", "wonderful", "linq", "beautiful", "world" };         var shortWords = from word in words                          where word.Length <= 5                          select word;         foreach (var word in shortWords)             Console.WriteLine(word);     } }