querybuilder icon indicating copy to clipboard operation
querybuilder copied to clipboard

Possible documentation error

Open nester-a opened this issue 2 years ago • 0 comments

I think I found an error in your documentation in the "data pagination" section.

// users is of type `PaginationResult`
var users = query.Paginate(1, 10);

foreach(var user in users.Each)
{
    Console.WriteLine($"Id: {user.Id}, Name: {user.Name}");
}

In this example, it means that we can iterate over the returned data.

But this example incorrect. In fact users.Each returns PaginationIterator<T> which has this enumerator:

public IEnumerator<PaginationResult<T>> GetEnumerator()
        {
            CurrentPage = FirstPage;
            yield return CurrentPage;
            while (CurrentPage.HasNext)
            {
                CurrentPage = CurrentPage.Next();
                yield return CurrentPage;
            }
        }

Is this a mistake in the documentation, or am I just misunderstanding it?

nester-a avatar Dec 18 '23 07:12 nester-a