Skip to content

A simple class that accepts a collection of items and paginates the results.

Notifications You must be signed in to change notification settings

lackd/.NET-CNPagedList

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

.NET-CNPagedList

A simple class that accepts an IQueryable, a page number parameter, and a page size parameter, and paginates the results. This is useful when returning a paginated list from a WebApi project.

Usage

To create a paginated list:

CNPagedList<Model> pagedList = new CNPagedList<Model>(queryable, page, pageLimit);

The parameters page and pageLimit are optional. If they are not provided, the CNPagedList will contain all of the items in the queryable.

JSON Example

This is an example of a JSON response returned from the WebApi.

... assume we specify page size of 3, and there are a total of 10 items ...

{
  "items": [
    {
      "name":"Item 1"
    },
    {
      "name":"Item 2"
    },
    {
      "name":"Item 3"
    }
  ],
  "page": 1,
  "pageSize":3,
  "totalItemCount":10
}

About

A simple class that accepts a collection of items and paginates the results.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%