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

◆ ElementAt< TSource >() [1/2]

static TSource System.Linq.Enumerable.ElementAt< TSource > ( this IEnumerable< TSource > source,
Index index )
inlinestatic

Definition at line 4643 of file Enumerable.cs.

4644 {
4645 if (source == null)
4646 {
4647 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
4648 }
4649 if (!index.IsFromEnd)
4650 {
4651 return source.ElementAt(index.Value);
4652 }
4653 if (source.TryGetNonEnumeratedCount(out var count))
4654 {
4655 return source.ElementAt(count - index.Value);
4656 }
4657 if (!TryGetElementFromEnd<TSource>(source, index.Value, out var element))
4658 {
4659 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index);
4660 }
4661 return element;
4662 }

References System.Linq.count, System.Linq.index, System.Linq.source, System.Linq.ThrowHelper.ThrowArgumentNullException(), and System.Linq.ThrowHelper.ThrowArgumentOutOfRangeException().