Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

790
Visualizações
Does anyone know what a AsyncPageable is?

I'm trying to do a get all from an Azure service and it returns an AsyncPageable. According to the doc it says

A collection of values that may take multiple service requests to iterate over.

Does that mean that it is equal to doing the request for a single item multiple times with a loop?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

If a service call returns multiple values in pages it would return Pageable<T>/AsyncPageable<T> as a result. Check out Consuming Service Methods Returning AsyncPageable.

To get more clarity, have a look at below: This shows control over receiving pages of values from the service use AsyncPageable<T>.AsPages method:

// call a service method, which returns AsyncPageable<T>
AsyncPageable<SecretProperties> response = client.GetPropertiesOfSecretsAsync();

await foreach (Page<SecretProperties> page in response.AsPages())
{
    // enumerate through page items
    foreach (SecretProperties secretProperties in page.Values)
    {
        Console.WriteLine(secretProperties.Name);
    }

    // get continuation token that can be used in AsPages call to resume enumeration
    Console.WriteLine(page.ContinuationToken);
}

If your project doesn't have C# 8.0 enabled you can still iterate over AsyncPageable using a while loop:

// call a service method, which returns AsyncPageable<T>
AsyncPageable<SecretProperties> response = client.GetPropertiesOfSecretsAsync();

IAsyncEnumerator<SecretProperties> enumerator = response.GetAsyncEnumerator();
try
{
    while (await enumerator.MoveNextAsync())
    {
        SecretProperties secretProperties = enumerator.Current;
        Console.WriteLine(secretProperties.Name);
    }
}
finally
{
    await enumerator.DisposeAsync();
}

Check out Azure.Core Response samples to understand more about this.

To change page size, you can use pageSizeHint parameter to AsPages method.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda