In this article we will learn, how to use LINQ Min() Function or what is LINQ Min() Function C# Mvc with example.



In LINQ, The Min() Function gives us the minimum value from a collection or List. It is use to get the minimum value from given collection or List. LINQ has made it very easy to find the minimum value from a given data collection or List. Otherwise in our normal coding we have to write quite bit of code to get minimum value from list of available values.

LINQ Min() Function Example

Now we will see the complete example of using linq Min() function to get minimum value from the list in C#.


using System;
using System.Collections.Generic;
using System.Linq;
namespace SQLTutorialsPoint
    class Program
        static void Main(string[] args)
            int[] Num = { 10, 20, 30, 40, 50, 60, 70, 80, 90 };
            Console.WriteLine("The Minimum value in the given array is:");
            int minimumNum = Num.Min();
            Console.WriteLine("The minimum Number is {0}", minimumNum);

When we execute above c# program, we will get the result like as shown below.

how to use min function in linq c#

As you see above example we have a integer array “Num” and we will find minimum value from the given array using LINQ Min() function


I hope it will help to you after reading.

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like