In LINQ, the Min() function is useful for getting the minimum value from a collection or list. LINQ has made it very easy to find the minimum value from a given data source. Otherwise, in our standard coding, we have to write quite a bit of code to get the minimum value from the list of available values.
Following is the syntax of using linq min() function to find the minimum value from the list of values.
If you observe the above syntax, we are trying to get the minimum value from the "Num" list using the linq Min() function.
We will see the complete examples of using the LINQ Min() function to get the minimum value from the list in c# and vb.net applications.
If you observe the above examples, we have a integer array “Num” and we are finding the minimum value from the given array using LINQ Min() function.
When we execute the above examples, we will get the result as shown below.
Following is the result of using the LINQ Min() function to find the lowest / minimum value from the list.
This is how we can use linq Min() funciton in c# and vb.net to get the minimum value from the list/collection.