openstack.net icon indicating copy to clipboard operation
openstack.net copied to clipboard

Support Simplified Paging

Open carolynvs opened this issue 8 years ago • 0 comments

In some cases, the user wants to bind to a single collection, and have it automatically request additional pages as needed. So by default it contains a single page of items, and when it is enumerated, if there is another page, request it behind the scenes and continue yielding items.

var results = _compute.ListServers().ToSinglePage();
foreach(var server in results)
{
    // GetNextPage is called automatically until all pages have been retrieved.
    // If it is enumerated again, it won't reload pages from the API
    Console.WriteLine(server.Name);
}

carolynvs avatar Dec 02 '15 20:12 carolynvs