Method MinBy
- Namespace
- Gamelogic.Extensions.Algorithms
- Assembly
- Gamelogic.Extensions.dll
MinBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>)
Finds the minimum element in the source as scored by its projection.
public static TSource MinBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> selector)
Parameters
source
IEnumerable<TSource>selector
Func<TSource, TKey>
Returns
- TSource
Type Parameters
TSource
TKey
MinBy<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 MinBy<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