示例#1
0
        public static async Task <IPagedList <T> > CreateAsync(IQueryable <T> superset, int pageNumber, int pageSize)
        {
            var list = new AsyncPagedList <T>();
            await list.InitAsync(superset, pageNumber, pageSize).ConfigureAwait(false);

            return(list);
        }
示例#2
0
 /// <summary>
 /// Async 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>
 /// <typeparam name="TKey">Type For Compare</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 Task <IPagedList <T> > ToPagedListAsync <T>(this IQueryable <T> superset, int pageNumber, int pageSize)
 {
     return(AsyncPagedList <T> .CreateAsync(superset, pageNumber, pageSize));
 }