public abstract class PagedEnumerable<TResponse, TResource> : IEnumerable<TResource>, IEnumerable
A sequence of resources obtained via API responses, each of which contributes a page of resources.
Application code can treat this as a simple sequence (with API calls automatically being made
lazily as more results are required), or call AsRawResponses() to retrieve
a page at a time, potentially with additional information.
public virtual Page<TResource> ReadPage(int pageSize)
Eagerly reads a single page of results with a fixed maximum size. The returned page is guaranteed
to have that many results, unless there is no more data available.
An asynchronous operation, the result of which is a page of resources.
Remarks
"Natural" pages returned by the API may contain a smaller number of resources than requested.
For example, a request for a page with 100 resources may return a page with 80 resources but
a next page token for more to be retrieved. This is suitable for batch-processing, but not
for user-visible paging such as in a web application, where fixed-size pages are expected.
This method may make more than one API call in order to fill the page, but after the page has been
returned, all the data will have been loaded. (In particular, iterating over the items in the page
multiple times will not make any further requests.)
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eThis document describes the \u003ccode\u003ePagedEnumerable<TResponse, TResource>\u003c/code\u003e class, which represents a sequence of resources obtained from API responses, where each response provides a page of resources.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePagedEnumerable\u003c/code\u003e class supports lazy loading of resources, making API calls automatically as more results are needed, or it can be used to retrieve raw API responses using the \u003ccode\u003eAsRawResponses()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eThe class implements \u003ccode\u003eIEnumerable<TResource>\u003c/code\u003e and \u003ccode\u003eIEnumerable\u003c/code\u003e, enabling it to be treated as a simple sequence of resources.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version documented is 4.10.0, with prior versions such as 4.8.0, 4.4.0, 4.3.1, 4.2.0, 4.0.0 and 3.2.0 also available.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ePagedEnumerable\u003c/code\u003e allows for the eager reading of a fixed-size page of results via the \u003ccode\u003eReadPage(int)\u003c/code\u003e method, ensuring the requested number of results are returned unless no more data is available.\u003c/p\u003e\n"]]],[],null,["# Class PagedEnumerable<TResponse, TResource> (4.10.0)\n\nVersion latestkeyboard_arrow_down\n\n- [4.10.0 (latest)](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2)\n- [4.8.0](/dotnet/docs/reference/Google.Api.Gax/4.8.0/Google.Api.Gax.PagedEnumerable-2)\n- [4.4.0](/dotnet/docs/reference/Google.Api.Gax/4.4.0/Google.Api.Gax.PagedEnumerable-2)\n- [4.3.1](/dotnet/docs/reference/Google.Api.Gax/4.3.1/Google.Api.Gax.PagedEnumerable-2)\n- [4.2.0](/dotnet/docs/reference/Google.Api.Gax/4.2.0/Google.Api.Gax.PagedEnumerable-2)\n- [4.0.0](/dotnet/docs/reference/Google.Api.Gax/4.0.0/Google.Api.Gax.PagedEnumerable-2)\n- [3.2.0](/dotnet/docs/reference/Google.Api.Gax/3.2.0/Google.Api.Gax.PagedEnumerable-2) \n\n public abstract class PagedEnumerable\u003cTResponse, TResource\u003e : IEnumerable\u003cTResource\u003e, IEnumerable\n\nA sequence of resources obtained via API responses, each of which contributes a page of resources.\nApplication code can treat this as a simple sequence (with API calls automatically being made\nlazily as more results are required), or call [AsRawResponses()](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2#Google_Api_Gax_PagedEnumerable_2_AsRawResponses) to retrieve\na page at a time, potentially with additional information. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e PagedEnumerable\\\u003cTResponse, TResource\\\u003e \n\nImplements\n----------\n\n[IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1), [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.ienumerable) \n\nInherited Members\n-----------------\n\n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring) \n\nDerived Types\n-------------\n\n[GrpcPagedEnumerable\\\u003cTRequest, TResponse, TResource\\\u003e](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcPagedEnumerable-3) \n[RestPagedEnumerable\\\u003cTRequest, TResponse, TResource\\\u003e](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.RestPagedEnumerable-3)\n\nNamespace\n---------\n\n[Google.Api.Gax](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax)\n\nAssembly\n--------\n\nGoogle.Api.Gax.dll\n\nMethods\n-------\n\n### AsRawResponses()\n\n public virtual IEnumerable\u003cTResponse\u003e AsRawResponses()\n\nReturns the sequence of raw API responses, each of which contributes a page of\nresources to this sequence.\n\n### GetEnumerator()\n\n public virtual IEnumerator\u003cTResource\u003e GetEnumerator()\n\n### ReadPage(int)\n\n public virtual Page\u003cTResource\u003e ReadPage(int pageSize)\n\nEagerly reads a single page of results with a fixed maximum size. The returned page is guaranteed\nto have that many results, unless there is no more data available.\n\n**Remarks** \n\"Natural\" pages returned by the API may contain a smaller number of resources than requested.\nFor example, a request for a page with 100 resources may return a page with 80 resources but\na next page token for more to be retrieved. This is suitable for batch-processing, but not\nfor user-visible paging such as in a web application, where fixed-size pages are expected.\nThis method may make more than one API call in order to fill the page, but after the page has been\nreturned, all the data will have been loaded. (In particular, iterating over the items in the page\nmultiple times will not make any further requests.)"]]