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
pageIndexintThe current page index (0-indexed).
pageSizeintThe number of items per page.
totalintThe 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
indexintThe requested page index (0-indexed).
pageSizeintThe number of items per page.
totalintThe 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
Returns
- int
The number of items to skip.