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

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

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

Definition at line 5727 of file Enumerable.cs.

5728 {
5729 if (source == null)
5730 {
5731 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
5732 }
5733 if (comparer == null)
5734 {
5735 comparer = Comparer<TSource>.Default;
5736 }
5737 TSource val = default(TSource);
5739 {
5740 if (val == null)
5741 {
5742 do
5743 {
5744 if (!enumerator.MoveNext())
5745 {
5746 return val;
5747 }
5748 val = enumerator.Current;
5749 }
5750 while (val == null);
5751 while (enumerator.MoveNext())
5752 {
5753 TSource current = enumerator.Current;
5754 if (current != null && comparer.Compare(current, val) > 0)
5755 {
5756 val = current;
5757 }
5758 }
5759 }
5760 else
5761 {
5762 if (!enumerator.MoveNext())
5763 {
5764 ThrowHelper.ThrowNoElementsException();
5765 }
5766 val = enumerator.Current;
5768 {
5769 while (enumerator.MoveNext())
5770 {
5771 TSource current2 = enumerator.Current;
5772 if (Comparer<TSource>.Default.Compare(current2, val) > 0)
5773 {
5774 val = current2;
5775 }
5776 }
5777 }
5778 else
5779 {
5780 while (enumerator.MoveNext())
5781 {
5782 TSource current3 = enumerator.Current;
5783 if (comparer.Compare(current3, val) > 0)
5784 {
5785 val = current3;
5786 }
5787 }
5788 }
5789 }
5790 }
5791 return val;
5792 }

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