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

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

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

Definition at line 4177 of file Enumerable.cs.

4178 {
4179 if (source == null)
4180 {
4181 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
4182 }
4183 if (selector == null)
4184 {
4185 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
4186 }
4187 using IEnumerator<TSource> enumerator = source.GetEnumerator();
4188 if (!enumerator.MoveNext())
4189 {
4190 ThrowHelper.ThrowNoElementsException();
4191 }
4192 double num = selector(enumerator.Current);
4193 long num2 = 1L;
4194 while (enumerator.MoveNext())
4195 {
4196 num += selector(enumerator.Current);
4197 num2++;
4198 }
4199 return num / (double)num2;
4200 }

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