C# Enumerable Min(IEnumerable)
Description
Returns the minimum value in a sequence of Int64 values.
Syntax
public static long Min(
this IEnumerable<long> source
)
Parameters
source
- A sequence of Int64 values to determine the minimum value of.
Returns
returns The minimum value in the sequence.
Example
The following code example demonstrates how to use Min(IEnumerable) to determine the minimum value in a sequence.
/* w ww.ja v a 2s .c o m*/
using System;
using System.Linq;
using System.Collections.Generic;
public class MainClass{
public static void Main(String[] argv){
double[] doubles = { 1.5E+104, 9E+103, -2E+103 };
double min = doubles.Min();
Console.WriteLine("The smallest number is {0}.", min);
System.Console.WriteLine();
}
}
The code above generates the following result.