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

◆ Min< TSource, TResult >()

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

Definition at line 7126 of file Enumerable.cs.

7127 {
7128 if (source == null)
7129 {
7130 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
7131 }
7132 if (selector == null)
7133 {
7134 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
7135 }
7136 TResult val = default(TResult);
7138 {
7139 if (val == null)
7140 {
7141 do
7142 {
7143 if (!enumerator.MoveNext())
7144 {
7145 return val;
7146 }
7147 val = selector(enumerator.Current);
7148 }
7149 while (val == null);
7150 Comparer<TResult> @default = Comparer<TResult>.Default;
7151 while (enumerator.MoveNext())
7152 {
7153 TResult val2 = selector(enumerator.Current);
7154 if (val2 != null && @default.Compare(val2, val) < 0)
7155 {
7156 val = val2;
7157 }
7158 }
7159 }
7160 else
7161 {
7162 if (!enumerator.MoveNext())
7163 {
7164 ThrowHelper.ThrowNoElementsException();
7165 }
7166 val = selector(enumerator.Current);
7167 while (enumerator.MoveNext())
7168 {
7169 TResult val3 = selector(enumerator.Current);
7170 if (Comparer<TResult>.Default.Compare(val3, val) < 0)
7171 {
7172 val = val3;
7173 }
7174 }
7175 }
7176 }
7177 return val;
7178 }

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