/// <summary> /// Returns an enumerator that iterates through the specified <see cref="ISegment{T}"/>. /// </summary> /// <param name="segmentIndex">The segment index of the position of the first element to enumerate.</param> /// <param name="elementIndex">The element index of the position of the first element to enumerate.</param> /// <param name="remainingCount">Upon return, the remaining number of elements that can be enumerated in the <see cref="ISegment{T}"/>.</param> /// <returns> /// An enumerator for the <see cref="ISegment{T}"/>. /// </returns> public IEnumerator <T> GetSegmentEnumerator(int segmentIndex, int elementIndex, out int remainingCount) { Debug.Assert(IsValidPosition(segmentIndex, elementIndex, false)); ISegment <T> Segment = SegmentTable[segmentIndex]; remainingCount = Segment.Count - elementIndex; Debug.Assert(remainingCount > 0); return(Segment.GetEnumerator(elementIndex)); }