openstack.net
openstack.net copied to clipboard
Support Simplified Paging
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);
}