-
Notifications
You must be signed in to change notification settings - Fork 4
/
PagedListExtensions.cs
20 lines (19 loc) · 1.23 KB
/
PagedListExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System;
using System.Linq;
using System.Threading.Tasks;
namespace PagedList.EntityFramework {
public static class PagedListExtensions {
/// <summary>
/// Creates a subset of this collection of objects that can be individually accessed by index and containing metadata about the collection of objects the subset was created from.
/// </summary>
/// <typeparam name="T">The type of object the collection should contain.</typeparam>
/// <param name="superset">The collection of objects to be divided into subsets. If the collection implements <see cref="IQueryable{T}"/>, it will be treated as such.</param>
/// <param name="pageNumber">The one-based index of the subset of objects to be contained by this instance.</param>
/// <param name="pageSize">The maximum size of any individual subset.</param>
/// <returns>A subset of this collection of objects that can be individually accessed by index and containing metadata about the collection of objects the subset was created from.</returns>
/// <seealso cref="PagedList{T}"/>
public static async Task<IPagedList<T>> ToPagedListAsync<T>(this IQueryable<T> superset, Int32 pageNumber, Int32 pageSize) {
return await PagedList<T>.Create(superset, pageNumber, pageSize);
}
}
}