C# Enumerable Min(IEnumerable>)

Description

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

Syntax


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

Parameters

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

Example

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


//  w w  w.j  a  v a 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 = { 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