Exemplo n.º 1
0
            public async Task <bool> MoveNextAsync(CancellationToken cancellationToken)
            {
                if (currentPageCollection == null)
                {
                    return(false);
                }
                if (currentEnumerator.MoveNext())
                {
                    return(true);
                }
                if (currentPageCollection.NextUri == null)
                {
                    return(false);
                }

                currentPageCollection = await currentPageCollection.ReadNextAsync(cancellationToken).ConfigureAwait(false);

                if (currentPageCollection == null)
                {
                    return(false);
                }

                currentEnumerator.Dispose();
                currentEnumerator = currentPageCollection.GetEnumerator();
                return(currentEnumerator.MoveNext());
            }
Exemplo n.º 2
0
            public PageCollectionReadToEndEnumerator(IPageCollection <T> pageCollection)
            {
                if (pageCollection == null)
                {
                    throw new ArgumentNullException(nameof(pageCollection));
                }

                this.initialPageCollection = pageCollection;
                this.currentPageCollection = pageCollection;
                this.currentEnumerator     = pageCollection.GetEnumerator();
            }
Exemplo n.º 3
0
 public void Reset()
 {
     currentEnumerator.Dispose();
     currentEnumerator = initialPageCollection.GetEnumerator();
 }