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

◆ TryGetLast() [1/3]

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

Definition at line 313 of file OrderedEnumerable.cs.

314 {
316 using IEnumerator<TElement> enumerator = _source.GetEnumerator();
317 while (enumerator.MoveNext())
318 {
319 TElement val = enumerator.Current;
320 if (!predicate(val))
321 {
322 continue;
323 }
324 comparer.SetElement(val);
325 while (enumerator.MoveNext())
326 {
327 TElement current = enumerator.Current;
328 if (predicate(current) && comparer.Compare(current, cacheLower: false) >= 0)
329 {
330 val = current;
331 }
332 }
333 found = true;
334 return val;
335 }
336 found = false;
337 return default(TElement);
338 }
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(), System.Collections.Generic.IEnumerable< out T >.GetEnumerator(), and System.Linq.predicate.