Table of Contents

Class Page<T>

Namespace
Olve.Utilities.Paginations
Assembly
Olve.Utilities.dll

A single page of items from a larger collection, with metadata describing position within that collection.

public sealed record Page<T> : IEquatable<Page<T>>

Type Parameters

T
Inheritance
Page<T>
Implements
Inherited Members

Constructors

Page(IReadOnlyList<T>, int, int, int)

A single page of items from a larger collection, with metadata describing position within that collection.

public Page(IReadOnlyList<T> Items, int PageNumber, int PageSize, int TotalCount)

Parameters

Items IReadOnlyList<T>

The items on this page.

PageNumber int

Zero-based index of this page.

PageSize int

Maximum number of items per page.

TotalCount int

Total number of items across all pages.

Properties

HasNextPage

Whether another page exists after this one.

public bool HasNextPage { get; }

Property Value

bool

Items

The items on this page.

public IReadOnlyList<T> Items { get; init; }

Property Value

IReadOnlyList<T>

Next

The Pagination that would fetch the next page, or null when this is the last page.

public Pagination? Next { get; }

Property Value

Pagination?

PageNumber

Zero-based index of this page.

public int PageNumber { get; init; }

Property Value

int

PageSize

Maximum number of items per page.

public int PageSize { get; init; }

Property Value

int

TotalCount

Total number of items across all pages.

public int TotalCount { get; init; }

Property Value

int

TotalPages

Total number of pages. Zero when PageSize is zero.

public int TotalPages { get; }

Property Value

int

Methods

ToSlice()

Converts this page to the equivalent Slice<T>. This is always possible.

public Slice<T> ToSlice()

Returns

Slice<T>

A Slice<T> with the same items and total count, where Offset = PageNumber * PageSize and Limit = PageSize.