Mega Code Archive

 
Categories / C# Book / 04 LINQ
 

0504 Min - Projection

public void Linq82() { string[] words = { "cherry", "apple", "blueberry" }; int shortestWord = words.Min(w => w.Length); Console.WriteLine("The shortest word is {0} characters long.", shortestWord); } Result The shortest word is 5 characters long.