AsyncPageable<T>
A collection of values that may take multiple service requests to
iterate over.
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading;
namespace Azure
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public abstract class AsyncPageable<T> : IAsyncEnumerable<T>
{
[System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1
})]
private class StaticPageable : AsyncPageable<T>
{
private readonly IEnumerable<Page<T>> _pages;
public StaticPageable(IEnumerable<Page<T>> pages)
{
_pages = pages;
}
[AsyncIteratorStateMachine(typeof(AsyncPageable<>.StaticPageable.<AsPages>d__2))]
public override IAsyncEnumerable<Page<T>> AsPages([System.Runtime.CompilerServices.Nullable(2)] string continuationToken = null, int? pageSizeHint = default(int?))
{
<AsPages>d__2 <AsPages>d__ = new <AsPages>d__2(-2);
<AsPages>d__.<>4__this = this;
<AsPages>d__.<>3__continuationToken = continuationToken;
return <AsPages>d__;
}
}
protected virtual CancellationToken CancellationToken { get; }
protected AsyncPageable()
{
CancellationToken = CancellationToken.None;
}
protected AsyncPageable(CancellationToken cancellationToken)
{
CancellationToken = cancellationToken;
}
public abstract IAsyncEnumerable<Page<T>> AsPages([System.Runtime.CompilerServices.Nullable(2)] string continuationToken = null, int? pageSizeHint = default(int?));
[AsyncIteratorStateMachine(typeof(AsyncPageable<>.<GetAsyncEnumerator>d__6))]
public virtual IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default(CancellationToken))
{
<GetAsyncEnumerator>d__6 <GetAsyncEnumerator>d__ = new <GetAsyncEnumerator>d__6(-3);
<GetAsyncEnumerator>d__.<>4__this = this;
<GetAsyncEnumerator>d__.cancellationToken = cancellationToken;
return <GetAsyncEnumerator>d__;
}
public static AsyncPageable<T> FromPages(IEnumerable<Page<T>> pages)
{
return new StaticPageable(pages);
}
[System.Runtime.CompilerServices.NullableContext(2)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override string ToString()
{
return base.ToString();
}
[System.Runtime.CompilerServices.NullableContext(2)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj)
{
return base.Equals(obj);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}