Back to Devexpress

How to Use Skip Tokens to Optimize Paging

wpf-120298-controls-and-libraries-data-grid-bind-to-data-bind-to-any-data-source-with-virtual-sources-use-skip-tokens-to-optimize-paging.md

latest1.0 KB
Original Source

How to Use Skip Tokens to Optimize Paging

  • Dec 10, 2023

This topic presents examples that demonstrate how to use skip tokens to optimize paging.

Complete Examples

Remarks

Using skip tokens , you can get the next page based on the previous one. It improves the performance of obtaining the next page.

In the following code sample, the lastId is a skip token:

csharp
var firstPage = queryable
    .OrderBy(x => x.Id)
    .Take(20)
    .ToArray();

var lastId = firstPage.Last().Id;
var secondPage = queryable
    .Where(x => x.Id > lastId)
    .OrderBy(x => x.Id)
    .Take(20)
    .ToArray();