你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

FeedIterator<T>.ReadNextAsync(CancellationToken) 方法

定义

从 cosmos 服务获取下一组结果

public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.FeedResponse<T>> ReadNextAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member ReadNextAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.FeedResponse<'T>>
Public MustOverride Function ReadNextAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of FeedResponse(Of T))

参数

cancellationToken
CancellationToken

(表示请求取消的可选) CancellationToken

返回

来自 cosmos 服务的查询响应

示例

有关如何完全清空查询结果的示例。

QueryDefinition queryDefinition = new QueryDefinition("select c.id From c where c.status = @status")
              .WithParameter("@status", "Failure");
using (FeedIterator<MyItem> feedIterator = this.Container.GetItemQueryIterator<MyItem>(
    queryDefinition))
{
    while (feedIterator.HasMoreResults)
    {
        FeedResponse<MyItem> response = await feedIterator.ReadNextAsync();
        foreach (var item in response)
        {
            Console.WriteLine(item);
        }
    }
}

适用于