C# Enumerable Max(IEnumerable>)
Description
Returns the maximum value in a sequence of nullable Double values.
Syntax
public static Nullable<double> Max(
this IEnumerable<Nullable<double>> source
)
Parameters
source
- A sequence of nullable Double values to determine the maximum value of.
Returns
Returns the maximum value in a sequence of nullable Double values.
Example
The following code example demonstrates how to use Max(IEnumerable) to determine the maximum value in a sequence.
//ww w .ja va2s. co m
using System;
using System.Linq;
using System.Collections.Generic;
public class MainClass{
public static void Main(String[] argv){
double?[] doubles = { null, 1.5E+104, 9E+103, -2E+103 };
double? max = doubles.Max();
Console.WriteLine("The largest number is {0}.", max);
}
}
The code above generates the following result.