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

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

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

Definition at line 4263 of file Enumerable.cs.

4264 {
4265 if (source == null)
4266 {
4267 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
4268 }
4269 if (selector == null)
4270 {
4271 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
4272 }
4274 {
4275 while (enumerator.MoveNext())
4276 {
4277 decimal? num = selector(enumerator.Current);
4278 if (!num.HasValue)
4279 {
4280 continue;
4281 }
4282 decimal valueOrDefault = num.GetValueOrDefault();
4283 long num2 = 1L;
4284 while (enumerator.MoveNext())
4285 {
4286 num = selector(enumerator.Current);
4287 if (num.HasValue)
4288 {
4289 valueOrDefault += num.GetValueOrDefault();
4290 num2++;
4291 }
4292 }
4293 return valueOrDefault / (decimal)num2;
4294 }
4295 }
4296 return null;
4297 }

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