public IEnumerator <T> GetEnumerator() => RangeStartIndex < 0 ? Reverse ? ViewedCollection.GetReverseEnumerator() : ViewedCollection.GetEnumerator() : Reverse ? ViewedCollection.GetReverseEnumerator( RangeStartIndex + Math.Max(0, RangeCount - 1), RangeCount) : ViewedCollection.GetEnumerator(RangeStartIndex, RangeCount);
public IEnumerator <T> GetReverseEnumerator(int startIndex, int rangeCount) { if (RangeStartIndex >= 0) { checkThisRangeCount(rangeCount, startIndex + 1); } return(RangeStartIndex < 0 ? Reverse ? ViewedCollection.GetEnumerator( Math.Max(0, ViewedCollection.Count - 1) - startIndex, rangeCount) : ViewedCollection.GetReverseEnumerator(startIndex, rangeCount) : Reverse ? ViewedCollection.GetEnumerator( (RangeStartIndex + Math.Max(0, RangeCount - 1)) - startIndex, rangeCount) : ViewedCollection.GetReverseEnumerator(RangeStartIndex + startIndex, rangeCount)); }