Click or drag to resize

IEnumerableExtensionMaxByTSource, TKey Method

Gets the greatest item of the sequence using comparer with the selector function returned values.

Namespace:  Gile.AutoCAD.R20.Extension
Assembly:  Gile.AutoCAD.R20.Extension (in Gile.AutoCAD.R20.Extension.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax
public static TSource MaxBy<TSource, TKey>(
	this IEnumerable<TSource> source,
	Func<TSource, TKey> selector,
	IComparer<TKey> comparer = null
)

Parameters

source
Type: System.Collections.GenericIEnumerableTSource
Sequence to which the method applies.
selector
Type: SystemFuncTSource, TKey
Mapping function from TSource to TKey.
comparer (Optional)
Type: System.Collections.GenericIComparerTKey
Comparer used for the TKey type; uses Comparer<TKey>.Default if null or omitted.

Type Parameters

TSource
Type the items.
TKey
Type of the returned value of selector function.

Return Value

Type: TSource
The greatest item in the sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableTSource. 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).
Exceptions
ExceptionCondition
ArgumentNullExceptionThrown if source is null.
ArgumentNullExceptionThrown if selector is null.
See Also