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

◆ TryGetElement< TSource >()

static bool System.Linq.Enumerable.TryGetElement< TSource > ( IEnumerable< TSource > source,
int index,
[MaybeNullWhen(false)] out TSource element )
inlinestaticprivate

Definition at line 4705 of file Enumerable.cs.

4706 {
4707 if (index >= 0)
4708 {
4709 using IEnumerator<TSource> enumerator = source.GetEnumerator();
4710 while (enumerator.MoveNext())
4711 {
4712 if (index == 0)
4713 {
4714 element = enumerator.Current;
4715 return true;
4716 }
4717 index--;
4718 }
4719 }
4720 element = default(TSource);
4721 return false;
4722 }

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

Referenced by System.Linq.Enumerable.ElementAtOrDefault< TSource >().