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

◆ TryGetLast() [3/3]

TElement System.Linq.OrderedEnumerable< TElement, TKey >.TryGetLast ( out bool found)
inline

Implements System.Linq.IPartition< TElement >.

Definition at line 177 of file OrderedEnumerable.cs.

178 {
179 using IEnumerator<TElement> enumerator = _source.GetEnumerator();
180 if (!enumerator.MoveNext())
181 {
182 found = false;
183 return default(TElement);
184 }
186 TElement val = enumerator.Current;
187 comparer.SetElement(val);
188 while (enumerator.MoveNext())
189 {
190 TElement current = enumerator.Current;
191 if (comparer.Compare(current, cacheLower: false) >= 0)
192 {
193 val = current;
194 }
195 }
196 found = true;
197 return val;
198 }
CachingComparer< TElement > GetComparer()
IEnumerable< TElement > _source
new IEnumerator< T > GetEnumerator()

References System.Linq.OrderedEnumerable< TElement, TKey >._source, System.comparer, System.Linq.OrderedEnumerable< TElement, TKey >.GetComparer(), and System.Collections.Generic.IEnumerable< out T >.GetEnumerator().

Referenced by System.Linq.OrderedPartition< TElement >.TryGetLast().