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

◆ Take< TSource >() [2/2]

static IEnumerable< TSource > System.Linq.Enumerable.Take< TSource > ( this IEnumerable< TSource > source,
Range range )
inlinestatic

Definition at line 8101 of file Enumerable.cs.

8102 {
8103 if (source == null)
8104 {
8105 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
8106 }
8107 Index start = range.Start;
8108 Index end = range.End;
8109 bool isFromEnd = start.IsFromEnd;
8110 bool isFromEnd2 = end.IsFromEnd;
8111 int value = start.Value;
8112 int value2 = end.Value;
8113 if (isFromEnd)
8114 {
8115 if (value == 0 || (isFromEnd2 && value2 >= value))
8116 {
8117 return Empty<TSource>();
8118 }
8119 }
8120 else if (!isFromEnd2)
8121 {
8122 if (value < value2)
8123 {
8125 }
8126 return Empty<TSource>();
8127 }
8129 }

References System.Index.IsFromEnd, System.Linq.source, System.start, System.Linq.ThrowHelper.ThrowArgumentNullException(), System.value, and System.Index.Value.