Class PagedList<T>
Class used to CollectionExtension.
Inheritance
Inherited Members
Namespace: StoneCo.Framework.Extension
Assembly: cs.temp.dll.dll
Syntax
[Serializable]
public class PagedList<T>
Type Parameters
Name | Description |
---|---|
T | List type provider to items. |
Constructors
PagedList()
Default constructor
Declaration
public PagedList()
PagedList(IEnumerable<T>, Int32, Int32, Int64, Boolean)
Default constructor to create a PagedList type. Very useful when transforming the object and passing the values from paged list to another.
Declaration
public PagedList(IEnumerable<T> items, int currentPage, int itemsPerPage, long totalCount, bool orderedAsc)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | items | Items collection. |
System.Int32 | currentPage | Current page of the item collection. |
System.Int32 | itemsPerPage | Items per page of result. |
System.Int64 | totalCount | Total of all items of all pages. |
System.Boolean | orderedAsc | Order by use true to ascending or false to descending. |
Examples
Foo class used in this example.
public class Foo
{
public int Id { get; private set; }
public string Name { get; private set; }
public Foo(string name) => Name = name;
}
Bar class used in this example.
public class Bar
{
public PagedList<Foo> TransformToPagedList(IList<Foo> fooList)
{
var currentPage = 1;
var itemsPerPage = 1;
var orderedAsc = true;
// Sample using the default contructor.
return new PagedList<Foo>(fooList, currentPage, itemsPerPage, fooList.Count, orderedAsc);
}
}
Properties
CurrentPage
Representing the current page.
Declaration
public int CurrentPage { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The default value is 0. |
Items
Collection of items paged.
Declaration
public IEnumerable<T> Items { get; set; }
Property Value
Type | Description |
---|---|
IEnumerable<T> | The default value is empty collection, not null. |
ItemsPerPage
Total of items per page.
Declaration
public int ItemsPerPage { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The default value is 0. |
OrderedAsc
Order by asending is equals true or descending is equals false.
Declaration
public bool OrderedAsc { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is false. |
TotalCount
Total of all items of all pages.
Declaration
public long TotalCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 | The default value is 0. |
TotalPages
Total of all pages of all items.
Declaration
public int TotalPages { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The default value is 0. |