linq Min
linq Min
Get the Min and Max value from a query.public static void Min() { // Min - Simple int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int minNum = numbers.Min(); Console.WriteLine("The minimum number is {0}.", minNum); // Min - Projection string[] words = { "cherry", "apple", "blueberry" }; int shortestWord = words.Min(w => w.Length); Console.WriteLine("The shortest word is {0} characters long.", shortestWord); }
Output
linq Min
Reviewed by Bhaumik Patel
on
7:16 PM
Rating: