C# Enumerable Min(IEnumerable)

Description

Returns the minimum value in a sequence of Double values.

Syntax


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

Parameters

  • source - A sequence of Double 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  w w. ja va2 s. 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);

  }
}
 

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Linq »




Enumerable