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

◆ Min< TSource >() [12/12]

static ? TSource System.Linq.Enumerable.Min< TSource > ( this IEnumerable< TSource > source,
IComparer< TSource >? comparer )
inlinestatic

Definition at line 6630 of file Enumerable.cs.

6631 {
6632 if (source == null)
6633 {
6634 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
6635 }
6636 if (comparer == null)
6637 {
6638 comparer = Comparer<TSource>.Default;
6639 }
6640 TSource val = default(TSource);
6642 {
6643 if (val == null)
6644 {
6645 do
6646 {
6647 if (!enumerator.MoveNext())
6648 {
6649 return val;
6650 }
6651 val = enumerator.Current;
6652 }
6653 while (val == null);
6654 while (enumerator.MoveNext())
6655 {
6656 TSource current = enumerator.Current;
6657 if (current != null && comparer.Compare(current, val) < 0)
6658 {
6659 val = current;
6660 }
6661 }
6662 }
6663 else
6664 {
6665 if (!enumerator.MoveNext())
6666 {
6667 ThrowHelper.ThrowNoElementsException();
6668 }
6669 val = enumerator.Current;
6671 {
6672 while (enumerator.MoveNext())
6673 {
6674 TSource current2 = enumerator.Current;
6675 if (Comparer<TSource>.Default.Compare(current2, val) < 0)
6676 {
6677 val = current2;
6678 }
6679 }
6680 }
6681 else
6682 {
6683 while (enumerator.MoveNext())
6684 {
6685 TSource current3 = enumerator.Current;
6686 if (comparer.Compare(current3, val) < 0)
6687 {
6688 val = current3;
6689 }
6690 }
6691 }
6692 }
6693 }
6694 return val;
6695 }

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