Mega Code Archive

 
Categories / C# Book / 04 LINQ
 

0407 Min

Input: IEnumerable<TSource> Optional lambda expression: TSource => TResult Min returns the smallest element from a sequence: using System; using System.Collections; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int[] numbers = { 28, 32, 14 }; int smallest = numbers.Min(); // 14; Console.WriteLine(smallest); } } The output: 14