src/BetterLinq/PageExtension.cs
/// <summary>
/// Paginates an enumeration and returns the parameters used for paginating along with the total number of 
/// elements in the entire collection.
/// </summary>
/// <typeparam name="T">The type of elements in the collection.</typeparam>
/// <param name="collection">The collection to be paginated.</param>
/// <param name="pageSize">The size of the page.</param>
/// <param name="pageNumber">The number of the page.</param>
/// <returns>The paginated collection.</returns>
/// <remarks>This method makes a call to LINQ's Count() method, which requires the
/// collection to be iterated immediately.</remarks>
Paginates an enumeration and returns the parameters used for paginating along with the total number of
elements in the entire collection.
Paginates an enumeration and returns the parameters used for paginating along with the total number of elements in the entire collection .
public static PageWithTotal<T> PageWithTotal<T>(this IEnumerable<T> collection, int pageSize, int pageNumber = 1)
        {
            return new PageWithTotal<T>(
                values: collection.Page(pageSize, pageNumber),
                pageSize: pageSize,
                pageNumber: pageNumber,
                total: collection.Count());
        }
public static PageWithTotal < T > PageWithTotal < T > ( this IEnumerable < T > collection , int pageSize , int pageNumber = 1 ) { return new PageWithTotal < T > ( values : collection . Page ( pageSize , pageNumber ) , pageSize : pageSize , pageNumber : pageNumber , total : collection . Count ( ) ) ; }
Paginates an enumeration and returns the parameters used for paginating along with the total number of
elements in the entire collection.
Paginates an enumeration and returns the parameters used for paginating along with the total number of elements in the entire collection .
The paginated collection.
The paginated collection .
IEnumerable<T>
this
pageSize
int
The size of the page.
The size of the page .
pageNumber
int
The number of the page.
The number of the page .
collection
The collection to be paginated.
The collection to be paginated .
typeparam
The type of elements in the collection.
The type of elements in the collection .
remarks
This method makes a call to LINQ's Count() method, which requires the
collection to be iterated immediately.
This method makes a call to LINQ ' s Count () method which requires the collection to be iterated immediately .