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

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

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

Definition at line 4049 of file Enumerable.cs.

4050 {
4051 if (source == null)
4052 {
4053 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
4054 }
4055 if (selector == null)
4056 {
4057 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
4058 }
4059 checked
4060 {
4061 using IEnumerator<TSource> enumerator = source.GetEnumerator();
4062 if (!enumerator.MoveNext())
4063 {
4064 ThrowHelper.ThrowNoElementsException();
4065 }
4066 long num = selector(enumerator.Current);
4067 long num2 = 1L;
4068 while (enumerator.MoveNext())
4069 {
4070 num += selector(enumerator.Current);
4071 num2++;
4072 }
4073 return (double)num / (double)num2;
4074 }
4075 }

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().