Method MaxBy
- Namespace
- Gamelogic.Extensions.Algorithms
- Assembly
- Gamelogic.Extensions.dll
MaxBy<T>(IEnumerable<T>, Func<T, IComparable>)
Finds the maximum element in the source as scored by the given function.
public static T MaxBy<T>(this IEnumerable<T> source, Func<T, IComparable> score)
Parameters
source
IEnumerable<T>score
Func<T, IComparable>
Returns
- T
Type Parameters
T
MaxBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>)
Finds the minimum element in the source as scored by its projection.
public static TSource MaxBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> selector)
Parameters
source
IEnumerable<TSource>selector
Func<TSource, TKey>
Returns
- TSource
Type Parameters
TSource
TKey
MaxBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>, IComparer<TKey>)
Finds the minimum element in the source as scored by the given function applied to a projection on the elements.
public static TSource MaxBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> selector, IComparer<TKey> comparer)
Parameters
source
IEnumerable<TSource>selector
Func<TSource, TKey>comparer
IComparer<TKey>
Returns
- TSource
Type Parameters
TSource
TKey