C# Enumerable Max(IEnumerable)
Description
Returns the maximum value in a sequence of Double values.
Syntax
public static double Max(
this IEnumerable<double> source
)
Parameters
source
- A sequence of Double values to determine the maximum value of.
Returns
returns The maximum value in the sequence.
Example
The following code example demonstrates how to use Max(IEnumerable) to determine the maximum value in a sequence.
//from w ww . j a va 2 s . c o m
using System;
using System.Linq;
using System.Collections.Generic;
public class MainClass{
public static void Main(String[] argv){
List<long> longs = new List<long> { 123123L, 123123L, 123L };
long max = longs.Max();
Console.WriteLine("The largest number is {0}.", max);
}
}
The code above generates the following result.