C# Enumerable Min(IEnumerable)

Description

Returns the minimum value in a sequence of Single values.

Syntax


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

Parameters

  • source - A sequence of Single 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.


/*from  w ww  .  j  av  a  2  s .c om*/

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