C# Enumerable Min(IEnumerable>)

Description

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

Syntax


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

Parameters

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

Returns

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

Example

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


//from  ww w. j  ava  2s  .c o m
using System;
using System.Linq;
using System.Collections.Generic;
public class MainClass{
  public static void Main(String[] argv){  
 
    int?[] grades = { 78, 92, null, 99, 37, 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