AsyncPageable<T> 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<T> : System.Collections.Generic.IAsyncEnumerable<T>
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<T>
- Implements
Examples
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();
}
Constructors
AsyncPageable<T>() |
Initializes a new instance of the AsyncPageable<T> class for mocking. |
AsyncPageable<T>(CancellationToken) |
Initializes a new instance of the AsyncPageable<T> class. |
Properties
CancellationToken |
Gets a CancellationToken used for requests made while enumerating asynchronously. |
Methods
AsPages(String, Nullable<Int32>) |
Enumerate the values a Page<T> at a time. This may make multiple service requests. |
FromPages(IEnumerable<Page<T>>) |
Creates an instance of Pageable<T> using the provided pages. |
GetAsyncEnumerator(CancellationToken) |
Enumerate the values in the collection asynchronously. This may make multiple service requests. |
Applies to
Azure SDK for .NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기