Esempio n. 1
0
            /// <summary>
            /// Initializes a new instance of the <see cref="LargeEnumerator"/> struct.
            /// Creates an instance that enumerates objects over a collection of segments.
            /// </summary>
            /// <param name="partition">The collection of segments enumerated by the new enumerator.</param>
            /// <param name="index">The index of the first item to enumerate.</param>
            /// <param name="count">The number of items to enumerate.</param>
            internal LargeEnumerator(IPartition <T> partition, long index, long count)
            {
                Partition = partition;

                int SegmentIndex;
                int ElementIndex;
                int CacheIndex;

                Partition.GetPosition(index, out SegmentIndex, out ElementIndex, out CacheIndex);

                Enumerator = Partition.GetEnumerator(SegmentIndex, ElementIndex);
                Count      = count;
            }
Esempio n. 2
0
            public override bool MoveNext()
            {
                switch (state)
                {
                case 1:
                    _enumerator = _source.GetEnumerator();
                    state       = 2;
                    goto case 2;

                case 2:
                    if (_enumerator.MoveNext())
                    {
                        current = _selector(_enumerator.Current);
                        return(true);
                    }
                    Dispose();
                    break;
                }
                return(false);
            }