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

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

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

Definition at line 4238 of file Enumerable.cs.

4239 {
4240 if (source == null)
4241 {
4242 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
4243 }
4244 if (selector == null)
4245 {
4246 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
4247 }
4248 using IEnumerator<TSource> enumerator = source.GetEnumerator();
4249 if (!enumerator.MoveNext())
4250 {
4251 ThrowHelper.ThrowNoElementsException();
4252 }
4253 decimal num = selector(enumerator.Current);
4254 long num2 = 1L;
4255 while (enumerator.MoveNext())
4256 {
4257 num += selector(enumerator.Current);
4258 num2++;
4259 }
4260 return num / (decimal)num2;
4261 }

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