Esempio n. 1
0
            /// <summary>Advances to the next element in the flattened enumerable. Enumerables that contain no elements are automatically skipped.</summary>
            /// <returns><see langword="true"/> if the enumerator advanced to the next element, otherwise <see langword="false"/> if there were no remaining elements to enumerate.</returns>
            public bool MoveNext()
            {
                while (innerFlattenedEnumerator?.MoveNext() != true)
                {
                    if (!outerEnumerator.MoveNext())
                    {
                        return(false);
                    }

                    innerFlattenedEnumerator = new(outerEnumerator.Current.GetEnumerator());
                }

                current = innerFlattenedEnumerator.Current;
                return(true);
            }
Esempio n. 2
0
 /// <summary>Initializes a new instance of the <seealso cref="Enumerator"/> class out of a <seealso cref="FlattenedEnumerables2D{T}"/> instance.</summary>
 /// <param name="instance">The <seealso cref="FlattenedEnumerables2D{T}"/> whose enumerables will be flattened.</param>
 public Enumerator(FlattenedEnumerables2D <T> instance)
 {
     outerEnumerator = instance.enumerables.GetEnumerator();
 }
Esempio n. 3
0
 /// <inheritdoc/>
 public void Reset()
 {
     outerEnumerator.Reset();
     innerFlattenedEnumerator = null;
 }