/// <summary> /// Initializes a new instance of the <see cref="PartitionEnumerator{T}"/> class. /// Creates an instance that enumerates objects starting at the specified position in <see cref="IPartition{T}"/>. /// </summary> /// <param name="partition">The enumerated partition.</param> /// <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> public PartitionEnumerator(IPartition <T> partition, int segmentIndex, int elementIndex) { Debug.Assert(partition.IsValidPosition(segmentIndex, elementIndex, false)); Partition = partition; SegmentIndex = segmentIndex; Enumerator = partition.GetSegmentEnumerator(segmentIndex, elementIndex, out SegmentCount); }