Class EnumerablePagedListExtensions
Enumerable分页扩展
public static class EnumerablePagedListExtensions
- Inheritance
-
EnumerablePagedListExtensions
- Inherited Members
Methods
ToPagedList<T>(IEnumerable<T>, int, int, int)
Creates a paginated list from a collection of items.
public static IPagedList<T> ToPagedList<T>(this IEnumerable<T> source, int pageIndex, int pageSize, int indexFrom = 0)
Parameters
source
IEnumerable<T>The collection of items to be paginated.
pageIndex
intSpecifies the index of the page to retrieve.
pageSize
intDetermines the number of items to include on each page.
indexFrom
intIndicates the starting index for pagination, defaulting to zero.
Returns
- IPagedList<T>
Returns a paginated list containing the specified page of items.
Type Parameters
T
Represents the type of elements in the collection being paginated.
ToPagedList<TSource, TResult>(IPagedList<TSource>, Func<IEnumerable<TSource>, IEnumerable<TResult>>)
Converts a source paged list into a new paged list of a different type using a specified converter function.
public static IPagedList<TResult> ToPagedList<TSource, TResult>(this IPagedList<TSource> source, Func<IEnumerable<TSource>, IEnumerable<TResult>> converter)
Parameters
source
IPagedList<TSource>The original paged list that contains elements to be converted.
converter
Func<IEnumerable<TSource>, IEnumerable<TResult>>A function that transforms a collection of the original elements into a collection of the new type.
Returns
- IPagedList<TResult>
A new paged list containing the converted elements.
Type Parameters
TSource
Represents the type of elements in the original paged list.
TResult
Represents the type of elements in the resulting paged list after conversion.