Method MaxElement
MaxElement<T, TKey>(IEnumerable<T>, Func<T, TKey>)
Finds out element with maximum value in the container.
public static T MaxElement<T, TKey>(this IEnumerable<T> container, Func<T, TKey> valuingFoo) where TKey : IComparable
Parameters
container
IEnumerable<T>The container to probe.
valuingFoo
Func<T, TKey>Method calculates max value.
Returns
- T
Maximal element in the container.
Type Parameters
T
The type of the elements of the container.
TKey
The type of key value to calculate maximum.