AsyncPageable Class
Definition
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 : System.Collections.Generic.IAsyncEnumerable
type AsyncPageable<'T> = class
interface IAsyncEnumerable<'T>
Public MustInherit Class AsyncPageable(Of T)
Implements IAsyncEnumerable(Of T)
Type Parameters
- T
The type of the values.
- Inheritance
-
AsyncPageable
- Implements
Examples
Example of enumerating an AsyncPageable using the async foreach loop:
// call a service method, which returns AsyncPageable
AsyncPageable 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
AsyncPageable allSecretProperties = client.GetPropertiesOfSecretsAsync();
IAsyncEnumerator enumerator = allSecretProperties.GetAsyncEnumerator();
try
{
while (await enumerator.MoveNextAsync())
{
SecretProperties secretProperties = enumerator.Current;
Console.WriteLine(secretProperties.Name);
}
}
finally
{
await enumerator.DisposeAsync();
}
Constructors
| Name | Description |
|---|---|
|
AsyncPageable |
Initializes a new instance of the AsyncPageable |
|
AsyncPageable |
Initializes a new instance of the AsyncPageable |
Properties
| Name | Description |
|---|---|
| CancellationToken |
Gets a CancellationToken used for requests made while enumerating asynchronously. |
Methods
| Name | Description |
|---|---|
|
AsPages(String, Nullable |
Enumerate the values a Page |
|
FromPages(IEnumerable |
Creates an instance of Pageable |
| GetAsyncEnumerator(CancellationToken) |
Enumerate the values in the collection asynchronously. This may make multiple service requests. |