# LINQ Min Function to Get Minimum Value From List

Keywords : How to use linq min() function to find minimum value from list / query with example, Linq select min / minimum value from list with example, Linq to find / select minimum value with example

Here we will learn linq min() function / operator with example in c#, vb.net and how to use min() function / operator to find or get minimum value from the list with example in c#, vb.net.

## LINQ MIN() Function

As the name suggests Min () function in liq gives us 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 normal coding we have to write quite bit of code to get minimum value from list of available values.

## Syntax of LINQ MIN() Function

Following is the syntax of using linq min() function to find minimum value from list of values.

C# Code

int[] Num = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

int minimumNum = Num.Min();

VB.NET Code

Dim Num As Integer() = {1, 2, 3, 4, 5, 6, 7, 8, 9}

Dim minimumNum As Integer = Num.Min()

If you observe above syntax we are getting minimum value from "Num" list using linq Min() function.

## LINQ Min() Function Example

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

C# Code

using System;

using System.Collections.Generic;

using System.Linq;

namespace Linqtutorials

{

class Program

{

static void Main(string[] args)

{

int[] Num = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

Console.WriteLine("The Minimum value in the given array is:");

int minimumNum = Num.Min();

Console.WriteLine("The minimum Number is {0}", minimumNum);

}

}

}

VB.NET Code

Module Module1

Sub Main()

Dim Num As Integer() = {1, 2, 3, 4, 5, 6, 7, 8, 9}

Console.WriteLine("The Minimum value in the given array is:")

Dim minimumNum As Integer = Num.Min()

Console.WriteLine("The minimum Number is {0}", minimumNum)

End Sub

End Module

In this example we have a integer array “Num” and we will find minimum value from the given array using LINQ Min() function. Now we will run and see the output that would be like as shown below

## Output of LINQ Min() Function

Following is the result of using LINQ Min() function to find lowest / minimum value from the list.

The minimum value in the given array is:

The Minimum Number is 1

This is how we can use linq Min() funciton to get minimum value from the list / collection.