Find Lowest Number from a Collection in LINQ

Write the below code in a console application.

  1. class Program  
  2. {  
  3.     static void Main(string[] args)  
  4.     {  
  5.         int[] numbers = {  
  6.             12,  
  7.             343,  
  8.             345,  
  9.             657,  
  10.             4325,  
  11.             2234,  
  12.             234,  
  13.             34  
  14.         };  
  15.         intMinimumNum = numbers.Min();  
  16.         Console.WriteLine("The minimum Number is {0}", MinimumNum);  
  17.         Console.ReadLine();  
  18.     }  
  19. }  
The output is:


We got the lowest number from a collection in LINQ.

 

Ebook Download
View all
Learn
View all