Find lowest number in an array in LINQ
Introduction
We often need to find the lowest number in an array of integer or real number.
Here I will explain how easy it is to find lowest number in C# using LINQ.
public void FindLowest()
{
int[] arrAge = { 12, 8, 11, 13, 1, 28, 9, 67, 12, 10 };
int minAge = arrAge.Min();
Response.Write ("The minimum Age is {0}.", minAge);
}
Code Explanation
In the first line I have declared an array of int. In the second line you can see I have used Min function to get the minimum in the array.
Output
The minimum Age is 1