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

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

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

Definition at line 4116 of file Enumerable.cs.

4117 {
4118 if (source == null)
4119 {
4120 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
4121 }
4122 if (selector == null)
4123 {
4124 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
4125 }
4126 using IEnumerator<TSource> enumerator = source.GetEnumerator();
4127 if (!enumerator.MoveNext())
4128 {
4129 ThrowHelper.ThrowNoElementsException();
4130 }
4131 double num = selector(enumerator.Current);
4132 long num2 = 1L;
4133 while (enumerator.MoveNext())
4134 {
4135 num += (double)selector(enumerator.Current);
4136 num2++;
4137 }
4138 return (float)(num / (double)num2);
4139 }

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