Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Average< TSource >() [7/10]

static double System.Linq.Enumerable.Average< TSource > ( this IEnumerable< TSource > source,
Func< TSource, int > selector )
inlinestatic

Definition at line 3982 of file Enumerable.cs.

3983 {
3984 if (source == null)
3985 {
3986 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
3987 }
3988 if (selector == null)
3989 {
3990 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
3991 }
3992 checked
3993 {
3994 using IEnumerator<TSource> enumerator = source.GetEnumerator();
3995 if (!enumerator.MoveNext())
3996 {
3997 ThrowHelper.ThrowNoElementsException();
3998 }
3999 long num = selector(enumerator.Current);
4000 long num2 = 1L;
4001 while (enumerator.MoveNext())
4002 {
4003 num += selector(enumerator.Current);
4004 num2++;
4005 }
4006 return (double)num / (double)num2;
4007 }
4008 }

References System.Collections.Generic.Dictionary< TKey, TValue >.GetEnumerator(), System.L, System.Linq.selector, System.Linq.source, System.Linq.ThrowHelper.ThrowArgumentNullException(), and System.Linq.ThrowHelper.ThrowNoElementsException().