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()); }
public PageCollectionReadToEndEnumerator(IPageCollection <T> pageCollection) { if (pageCollection == null) { throw new ArgumentNullException(nameof(pageCollection)); } this.initialPageCollection = pageCollection; this.currentPageCollection = pageCollection; this.currentEnumerator = pageCollection.GetEnumerator(); }
public void Reset() { currentEnumerator.Dispose(); currentEnumerator = initialPageCollection.GetEnumerator(); }