Click or drag to resize

CollectionExtensionsToPagedListT Method

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

Namespace: GSF.Collections
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
public static PagedList<T> ToPagedList<T>(
	this IEnumerable<T> source,
	int page,
	int pageSize,
	int count = -1
)
View Source

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