C# Enumerable Min(IEnumerable>)

Description

Returns the minimum value in a sequence of nullable Double values.

Syntax


public static Nullable<double> Min(
  this IEnumerable<Nullable<double>> source
)

Parameters

  • source - A sequence of nullable Double values to determine the minimum value of.

Returns

Returns the minimum value in a sequence of nullable Double values.

Example

The following code example demonstrates how to use Min(IEnumerable) to determine the minimum value in a sequence.


/*  w ww. j a  va 2 s  . c o  m*/
using System;
using System.Linq;
using System.Collections.Generic;
public class MainClass{
  public static void Main(String[] argv){  

    int?[] grades = { 718, 912, null, 919, 317, 81 };

    int? min = grades.Min();

    Console.WriteLine("The lowest grade is {0}.", min);

  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Linq »




Enumerable