Class PagedCollection<T>
Represents an System.Collections.Generic.IEnumerable<T> paged data sequence.
Implements
Inherited Members
Namespace: Cuemon.Collections.Generic
Assembly: Cuemon.Core.dll
Syntax
public class PagedCollection<T> : PagedCollection, IEnumerable<T>, IEnumerable
Type Parameters
Name | Description |
---|---|
T | The type of the elements of this instance. |
Constructors
| Improve this DocPagedCollection(IEnumerable<T>)
Initializes a new instance of the PagedCollection<T> class.
Declaration
public PagedCollection(IEnumerable<T> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | The source of the sequence. |
Remarks
This will do a System.Linq.Enumerable.Count<TSource>(IEnumerable<TSource>) on source
; so if your source is fragile consider providing this information in the overloaded constructor.
PagedCollection(IEnumerable<T>, PagedSettings)
Initializes a new instance of the PagedCollection<T> class.
Declaration
public PagedCollection(IEnumerable<T> source, PagedSettings settings)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | The source of the sequence. |
PagedSettings | settings | The PagedSettings that will be applied to this instance. |
PagedCollection(IEnumerable<T>, PagedSettings, Int32)
Initializes a new instance of the PagedCollection<T> class.
Declaration
public PagedCollection(IEnumerable<T> source, PagedSettings settings, int totalElementCount)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | The source of the sequence. |
PagedSettings | settings | The PagedSettings that will be applied to this instance. |
System.Int32 | totalElementCount | The total number of elements in the |
PagedCollection(Func<PagedSettings, IEnumerable<T>>, PagedSettings, Func<PagedSettings, Int32>)
Initializes a new instance of the PagedCollection<T> class.
Declaration
public PagedCollection(Func<PagedSettings, IEnumerable<T>> selector, PagedSettings settings, Func<PagedSettings, int> counter)
Parameters
Type | Name | Description |
---|---|---|
System.Func<PagedSettings, System.Collections.Generic.IEnumerable<T>> | selector | The function delegate that will define the System.Collections.Generic.IEnumerable<T> source sequence of this instance. |
PagedSettings | settings | The PagedSettings that will be applied to this instance. |
System.Func<PagedSettings, System.Int32> | counter | The function delegate that will define the TotalElementCount of this instance. |
Properties
| Improve this DocCount
Gets the number of elements on the current page.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of elements on the current page. |
FirstPage
Gets a value indicating whether this instance is on the first paged data sequence.
Declaration
public bool FirstPage { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
HasNextPage
Gets a value indicating whether this instance has a next paged data sequence.
Declaration
public bool HasNextPage { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
HasPreviousPage
Gets a value indicating whether this instance has a previous paged data sequence.
Declaration
public bool HasPreviousPage { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Item[Int32]
Gets the element at the specified index.
Declaration
public T this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to get. |
Property Value
Type | Description |
---|---|
T | The element at the specified index. |
LastPage
Gets a value indicating whether this instance is on the last paged data sequence.
Declaration
public bool LastPage { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
PageCount
Gets the total amount of pages for the elements in this sequence.
Declaration
public int PageCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The total amount of pages for the elements in this sequence. |
Settings
Gets the settings that specifies the paging features of this instance.
Declaration
public PagedSettings Settings { get; }
Property Value
Type | Description |
---|---|
PagedSettings | The settings that specifies the paging features of this instance. |
TotalElementCount
Gets the total number of elements in the sequence before paging is applied.
Declaration
public int TotalElementCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The total number of elements in the sequence before paging is applied. |
Methods
| Improve this DocGetEndOfNextPageRange(Int32)
Gets the last number of the next page range relative to the specified page
.
Declaration
public int GetEndOfNextPageRange(int page)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | page | The page to calculate the last number of the next page range. |
Returns
Type | Description |
---|---|
System.Int32 | An System.Int32 that represents the last number of the next page range. |
GetEnumerator()
Returns an enumerator that iterates through the paged collection.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<T> | A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the paged collection. |
GetStartOfNextPageRange(Int32)
Gets the first number of the next page range relative to the specified page
.
Declaration
public int GetStartOfNextPageRange(int page)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | page | The page to calculate the first number of the next page range. |
Returns
Type | Description |
---|---|
System.Int32 | An System.Int32 that represents the first number of the next page range. |
ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Overrides
Explicit Interface Implementations
| Improve this DocIEnumerable.GetEnumerator()
Returns an enumerator that iterates through a paged collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator object that can be used to iterate through the paged collection. |