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

◆ Max< TSource, TResult >()

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

Definition at line 6263 of file Enumerable.cs.

6264 {
6265 if (source == null)
6266 {
6267 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
6268 }
6269 if (selector == null)
6270 {
6271 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
6272 }
6273 TResult val = default(TResult);
6275 {
6276 if (val == null)
6277 {
6278 do
6279 {
6280 if (!enumerator.MoveNext())
6281 {
6282 return val;
6283 }
6284 val = selector(enumerator.Current);
6285 }
6286 while (val == null);
6287 Comparer<TResult> @default = Comparer<TResult>.Default;
6288 while (enumerator.MoveNext())
6289 {
6290 TResult val2 = selector(enumerator.Current);
6291 if (val2 != null && @default.Compare(val2, val) > 0)
6292 {
6293 val = val2;
6294 }
6295 }
6296 }
6297 else
6298 {
6299 if (!enumerator.MoveNext())
6300 {
6301 ThrowHelper.ThrowNoElementsException();
6302 }
6303 val = selector(enumerator.Current);
6304 while (enumerator.MoveNext())
6305 {
6306 TResult val3 = selector(enumerator.Current);
6307 if (Comparer<TResult>.Default.Compare(val3, val) > 0)
6308 {
6309 val = val3;
6310 }
6311 }
6312 }
6313 }
6314 return val;
6315 }

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