[Enhancement] DefaultIfEmptyF should be implemented
Smurf-IV opened this issue · comments
Simon Coghlan commented
Both versions of this to work with List<T>, Array[T], Span<T>, ReadOnlySpan<T>
and IReadOnlyList<T>
If the source is null or empty, then default to creating an array so that max speed is maintained.
Simon Coghlan commented
Should this also follow the pattern for the other "Fast" api's e.g WhereSelect
i.e.
public static int MaxOrDefault<T>(this IEnumerable<T> enumeration, Func<T, int> selector)
{
return enumeration.Any() ? enumeration.Max(selector) : default(int);
}