11
Perhaps a useless question:
public static double Average<TSource>(
this IEnumerable<TSource> source,
Func<TSource, int> selector
)
One of exceptions thrown by the above method is also OverflowException: The sum of the elements in the sequence is larger than Int64.MaxValue.
I assume reason for this exception is that sum of the averaged values is computed using variable S of type long? But since return value is of type double, why didn't designers choose to make S also of type double?
Thank you