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

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

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

Definition at line 6937 of file Enumerable.cs.

6938 {
6939 if (source == null)
6940 {
6941 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
6942 }
6943 if (selector == null)
6944 {
6945 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
6946 }
6947 float? result = null;
6948 using IEnumerator<TSource> enumerator = source.GetEnumerator();
6949 while (enumerator.MoveNext())
6950 {
6951 result = selector(enumerator.Current);
6952 if (!result.HasValue)
6953 {
6954 continue;
6955 }
6956 float num = result.GetValueOrDefault();
6957 if (float.IsNaN(num))
6958 {
6959 return result;
6960 }
6961 while (enumerator.MoveNext())
6962 {
6963 float? num2 = selector(enumerator.Current);
6964 if (num2.HasValue)
6965 {
6966 float valueOrDefault = num2.GetValueOrDefault();
6967 if (valueOrDefault < num)
6968 {
6969 num = valueOrDefault;
6970 result = num2;
6971 }
6972 else if (float.IsNaN(valueOrDefault))
6973 {
6974 return num2;
6975 }
6976 }
6977 }
6978 return result;
6979 }
6980 return result;
6981 }

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