CollectionExtensionsToPagedListT Method

Gets a PagedListT to paginate source enumeration for a given page and specified pageSize.

Definition

Namespace: Gemstone.Collections.CollectionExtensions
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.110 -- Release Build+3e0464f4461df4d3e1175b13966eb47ff832554d
public static PagedList<T> ToPagedList<T>(
	this IEnumerable<T> source,
	int page,
	int pageSize,
	int count = -1
)

Parameters

source  IEnumerableT
Source enumeration to paginate.
page  Int32
Page number (1-based).
pageSize  Int32
Page size.
count  Int32  (Optional)
Total records in source if known.

Type Parameters

T
Type of IEnumerableT to paginate.

Return Value

PagedListT
Set of items on a given page for specified pageSize.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

If count is known or can be calculated early, specify the value in the count parameter as an optimization to prevent a full enumeration on source to get a count.

See Also