LinqPaginator 1.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package LinqPaginator --version 1.2.1                
NuGet\Install-Package LinqPaginator -Version 1.2.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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                
#r "nuget: LinqPaginator, 1.2.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LinqPaginator as a Cake Addin
#addin nuget:?package=LinqPaginator&version=1.2.1

// Install LinqPaginator as a Cake Tool
#tool nuget:?package=LinqPaginator&version=1.2.1                

Linq Paginator

Build status Nuget Nuget

Retrieve collection results from IQueryable<T>, IEnumerable<T> or any array based data type that inherits ICollection<T> 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<T> 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; }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net46 is compatible.  net461 is compatible.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.7 759 3/16/2021 1.2.7 is deprecated because it has critical bugs.
1.2.6 2,472 10/5/2020
1.2.5 524 9/28/2020
1.2.4 590 3/4/2020
1.2.3 640 9/7/2019
1.2.2 570 9/6/2019
1.2.1 540 9/6/2019
1.2.0 580 9/6/2019
1.1.0 608 7/24/2019
1.1.0-beta 426 6/26/2019
1.0.6 610 4/14/2019
1.0.5 642 2/17/2019
1.0.4 647 2/9/2019
1.0.3 685 2/6/2019
1.0.2 1,169 3/3/2018
1.0.1 942 3/2/2018
1.0.0 1,119 1/21/2018

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