Table of Contents

Class PagingHelper

Namespace
NuvTools.Data.Paging
Assembly
NuvTools.Data.dll

Helper methods for paging calculations.

public static class PagingHelper
Inheritance
PagingHelper
Inherited Members

Methods

CalculateHasNextPage(int, int, int)

Determines whether there is a next page based on the current page index, page size, and total count.

public static bool CalculateHasNextPage(int pageIndex, int pageSize, int total)

Parameters

pageIndex int

The current page index (0-indexed).

pageSize int

The number of items per page.

total int

The total number of items.

Returns

bool

True if there are more items beyond the current page; otherwise, false.

GetPageIndex(int, int, int)

Calculates the valid page index, ensuring it doesn't exceed the total number of pages.

public static int GetPageIndex(int index, int pageSize, int total)

Parameters

index int

The requested page index (0-indexed).

pageSize int

The number of items per page.

total int

The total number of items.

Returns

int

A valid page index (0-indexed) that doesn't exceed the total pages available.

GetSkip(int, int)

Calculates the number of items to skip for pagination.

public static int GetSkip(int index, int size)

Parameters

index int

The page index (0-indexed).

size int

The page size.

Returns

int

The number of items to skip.