LinqPaginator 1.2.1

For queries that return a lot of data, a need emerges to consume the results in chunks rather than the entire set. Consuming all results at once can be costly in terms of network traffic thus slowing down your application.
     Linq Paginator allows you to run your queries and return your data in form of pages. A page contains a set number of items to return per page e.g 20. If for example you have 100 records, it will return the following object:
     - Page: 1,
     - TotalPages: 5,
     - ItemsPerPage: 20,
     - TotalItems: 100,
     - List (collection of the first 20 records)

There is a newer version of this package available.
See the version list below for details.
Install-Package LinqPaginator -Version 1.2.1
dotnet add package LinqPaginator --version 1.2.1
<PackageReference Include="LinqPaginator" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LinqPaginator --version 1.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Linq Paginator

Build status
Nuget
Nuget

Retrieve collection results from IQueryable&lt;T&gt;, IEnumerable&lt;T&gt; or any array based data type that inherits ICollection&lt;T&gt; and packages the results into pages for easy fetching to enable lazy loading data on UI components in a fast way when pulling large sets of data.

Install

Install package from Nuget by running the following command in Package Manager Console.

Install-Package LinqPaginator -Version 1.0.6

Then go ahead add a using statement to reference the already downloaded package.

using LinqPaginator;

This library works with almost all arrays that inherit from ICollection&lt;T&gt; and it provides an extension method to paginate your collection as shown below passing a page number and the number of items to return per page.

Sample Data:
IList<string> _names = new List<string>();
_names.Add("Test-01");
_names.Add("Test-02");
_names.Add("Test-03");
_names.Add("Test-04");
_names.Add("Test-05");
Usage

You can use either of the methods.

PagedResult<string> result = _names.Page(page: 1, perpage: 2);
PagedResult<string> result = _names.Paged(page: 1, perpage: 2);
PagedResult<string> result = _names.Paginate(page: 1, perpage: 2);
PagedResult<string> result = _names.ToPages(page: 1, perpage: 2);
PagedResult<string> result = _names.ToPaginate(page: 1, perpage: 2);
Result Model
public struct PagedResult<T> 
{
    /// <summary>
    /// Current page in pagination
    /// </summary>
    public int Page { get; set; }
    /// <summary>
    /// Total number of items in every page as per
    /// pagination request. Defaults to 10.
    /// </summary>
    public int ItemsPerPage { get; set; }
    /// <summary>
    /// Number of pages used to paginate our <see cref="List"/> with
    /// each page containing (x) <see cref="ItemsPerPage"/>
    /// </summary>
    public int TotalPages { get; set; }
    /// <summary>
    /// Number of items matching your pagination request
    /// </summary>
    public int TotalItems { get; set; }
    /// <summary>
    /// Array containing items in the current page 
    /// </summary>
    public T[] List { get; set; }
}

Linq Paginator

Build status
Nuget
Nuget

Retrieve collection results from IQueryable&lt;T&gt;, IEnumerable&lt;T&gt; or any array based data type that inherits ICollection&lt;T&gt; and packages the results into pages for easy fetching to enable lazy loading data on UI components in a fast way when pulling large sets of data.

Install

Install package from Nuget by running the following command in Package Manager Console.

Install-Package LinqPaginator -Version 1.0.6

Then go ahead add a using statement to reference the already downloaded package.

using LinqPaginator;

This library works with almost all arrays that inherit from ICollection&lt;T&gt; and it provides an extension method to paginate your collection as shown below passing a page number and the number of items to return per page.

Sample Data:
IList<string> _names = new List<string>();
_names.Add("Test-01");
_names.Add("Test-02");
_names.Add("Test-03");
_names.Add("Test-04");
_names.Add("Test-05");
Usage

You can use either of the methods.

PagedResult<string> result = _names.Page(page: 1, perpage: 2);
PagedResult<string> result = _names.Paged(page: 1, perpage: 2);
PagedResult<string> result = _names.Paginate(page: 1, perpage: 2);
PagedResult<string> result = _names.ToPages(page: 1, perpage: 2);
PagedResult<string> result = _names.ToPaginate(page: 1, perpage: 2);
Result Model
public struct PagedResult<T> 
{
    /// <summary>
    /// Current page in pagination
    /// </summary>
    public int Page { get; set; }
    /// <summary>
    /// Total number of items in every page as per
    /// pagination request. Defaults to 10.
    /// </summary>
    public int ItemsPerPage { get; set; }
    /// <summary>
    /// Number of pages used to paginate our <see cref="List"/> with
    /// each page containing (x) <see cref="ItemsPerPage"/>
    /// </summary>
    public int TotalPages { get; set; }
    /// <summary>
    /// Number of items matching your pagination request
    /// </summary>
    public int TotalItems { get; set; }
    /// <summary>
    /// Array containing items in the current page 
    /// </summary>
    public T[] List { get; set; }
}

Release Notes

Fixes bug/issue with pagination result:
     -> TotalPages is always zero

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.2.3 71 9/7/2019
1.2.2 49 9/6/2019
1.2.1 47 9/6/2019
1.2.0 48 9/6/2019
1.1.0 67 7/24/2019
1.1.0-beta 60 6/26/2019
1.0.6 114 4/14/2019
1.0.5 113 2/17/2019
1.0.4 111 2/9/2019
1.0.3 111 2/6/2019
1.0.2 366 3/3/2018
1.0.1 256 3/2/2018
1.0.0 352 1/21/2018