Fork me on GitHub

PagedList<T> class

Represents a strongly typed list of objects that can be accessed by index and contains metadata for paging.
Public properties:
NameDescription
CurrentPageIndexGets or sets the current page index.
PageSizeGets or sets the number of data items that are displayed for each page of data.
TotalItemCountGets or sets the total number of data items that are available for paging.
TotalPageCountGets the total number of pages.
StartItemIndexGets the index of the first data item that is displayed on a page of data.
EndItemIndexGets the index of the last data item that is displayed on a page of data.

Constructtors:

public PagedList(IEnumerable<T> allItems, int pageIndex, int pageSize)
Description:
Initializes a new instance of the PagedList class using the data to be paged, current page index and page size.
Parameters:
allItems: object that contains all data to be paged and should implements IEnumerable<T> interface;
pageIndex: current page index;
pageSize: the number of records that are displayed for each page of data;
public PagedList(IEnumerable<T> currentPageItems, int pageIndex, int pageSize, int totalItemCount)
Description:
Initializes a new instance of the PagedList class using current page items, current page index, page size and the total item count.
Parameters:
currentPageItems: object that contains data to be displayed on page, should implements IEnumerable<T> interface;
pageIndex: current page index;
pageSize: the number of records that are displayed for each page of data;
totalItemCount: the total number of records that are available for paging;
public PagedList(IQueryable<T> allItems, int pageIndex, int pageSize)
Description:
Initializes a new instance of the PagedList class using the data to be paged, current page index and page size.
Parameters:
allItems: object that contains all data to be paged and should implements IQueryable<T> interface;
pageIndex: current page index;
pageSize: the number of records that are displayed for each page of data;
public PagedList(IQueryable<T> currentPageItems, int pageIndex, int pageSize, int totalItemCount)
Description:
Initializes a new instance of the PagedList class using current page items, current page index, page size and the total item count.
Parameters:
currentPageItems: object that contains data to be displayed on page, should implements IQueryable<T> interface;
pageIndex: current page index;
pageSize: the number of records that are displayed for each page of data;
totalItemCount: the total number of records that are available for paging;