public static int MaxOrDefault<TSource>(this IEnumerable<TSource> source,
Func<TSource, int> selector,
int defaultValue)
{
if (source.Any<TSource>())
return source.Max<TSource>(selector);
return defaultValue;
}
No Comments