Open Arcalise08 opened 3 months ago
Can you please share where did you see this example? Which is the documentation?
In
if (feedIterator.HasMoreResults)
{
var response = await feedIterator.ReadNextAsync();
list5.AddRange(response);
if (response.Count > 0)
{
continuation = response.ContinuationToken;
}
}
Capturing the continuation makes no sense because the query is executing completely.
In:
var response = await feedIterator.ReadNextAsync();
list5.AddRange(response);
if (response.Count > 0)
{
continuation = response.ContinuationToken;
break;
}
This is simply an example of how to yield a query. Given some condition (in this case Count > 0 but it could be anything that makes sense to you), capture the continuation to continue later at some other time and stop the query.
Please check the .NET usage examples for pagination
Thanks. So the issue is that the example is unclear on why it is capturing the token when it does?
Its unclear why its in a while
loop. If the entire point is to iterate once, then capture the continuation token (if there is one) and return the results. What is the point of putting it in a while
loop in the pagination example?
Hopefully I'm being clear here. The example will always only iterate once.
In all documentation relating to feed iterators it mentions using it in similar to the following way
Specifically the while loop here has led to some confusion. What's the purpose of a while loop that breaks when there are responses? Why wouldn't we use it in the following fashion for paged results?
Is there some reason specifically to use a while loop when it breaks when there's a response? I didn't know if this had anything to do with error retrying or something similar. And the code here is prevalent in most documentation and code comments.