C# Enumerable Min(IEnumerable>)
Description
Returns the minimum value in a sequence of nullable Int64 values.
Syntax
public static Nullable<long> Min(
this IEnumerable<Nullable<long>> source
)
Parameters
source
- A sequence of nullable Int64 values to determine the minimum value of.
Returns
Returns the minimum value in a sequence of nullable Int64 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 2s .c om*/
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.