Click or drag to resize

Extensions.MaxBy<TSource, TKey> Method (IEnumerable<TSource>, Func<TSource, TKey>)

Returns the item with the maximum value in a sequence of values.

Namespace:  Cauldron
Assembly:  Cauldron (in Cauldron.dll) Version: 3.2.0.1 (3.2.0.1)
Syntax
C#
public static TSource MaxBy<TSource, TKey>(
	this IEnumerable<TSource> source,
	Func<TSource, TKey> selector
)

Parameters

source
Type: System.Collections.Generic.IEnumerable<TSource>
A sequence of values to determine the minimum value of.
selector
Type: System.Func<TSource, TKey>
A delegate used to select the values

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the elements of selector.

Return Value

Type: TSource
The maximum value in the sequence

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<TSource>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also