AsyncPageable<T> Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A collection of values that may take multiple service requests to iterate over.
public abstract class AsyncPageable<T> : System.Collections.Generic.IAsyncEnumerable<T>
type AsyncPageable<'T> = class
interface IAsyncEnumerable<'T>
Public MustInherit Class AsyncPageable(Of T)
Implements IAsyncEnumerable(Of T)
- T
The type of the values.
- Inheritance
-
AsyncPageable<T>
- Implements
Example of enumerating an AsyncPageable using the async foreach
loop:
// call a service method, which returns AsyncPageable<T>
AsyncPageable<SecretProperties> allSecretProperties = client.GetPropertiesOfSecretsAsync();
await foreach (SecretProperties secretProperties in allSecretProperties)
{
Console.WriteLine(secretProperties.Name);
}
or using a while loop:
// call a service method, which returns AsyncPageable<T>
AsyncPageable<SecretProperties> allSecretProperties = client.GetPropertiesOfSecretsAsync();
IAsyncEnumerator<SecretProperties> enumerator = allSecretProperties.GetAsyncEnumerator();
try
{
while (await enumerator.MoveNextAsync())
{
SecretProperties secretProperties = enumerator.Current;
Console.WriteLine(secretProperties.Name);
}
}
finally
{
await enumerator.DisposeAsync();
}
Async |
Initializes a new instance of the AsyncPageable<T> class for mocking. |
Async |
Initializes a new instance of the AsyncPageable<T> class. |
Cancellation |
Gets a CancellationToken used for requests made while enumerating asynchronously. |
As |
Enumerate the values a Page<T> at a time. This may make multiple service requests. |
From |
Creates an instance of Pageable<T> using the provided pages. |
Get |
Enumerate the values in the collection asynchronously. This may make multiple service requests. |
Product | Versions |
---|---|
Azure SDK for .NET | Latest |
Azure SDK for .NET feedback
Azure SDK for .NET is an open source project. Select a link to provide feedback: