Page large result sets with LINQ
In Microsoft Dataverse, you can page the results of a large .NET Language-Integrated Query (LINQ) query by using the Take
and Skip
operators. The Take
operator retrieves a specified number of results and the Skip
operator skips over a specified number of results.
LINQ paging example
The following example shows how to page the results of a LINQ query by using the Take
and Skip
operators:
int pageSize = 5;
var accountsByPage = (from a in svcContext.AccountSet
select new Account
{
Name = a.Name,
});
System.Console.WriteLine("Skip 10 accounts, then Take 5 accounts");
System.Console.WriteLine("======================================");
foreach (var a in accountsByPage.Skip(2 * pageSize).Take(pageSize))
{
System.Console.WriteLine(a.Name);
}
See also
Build queries with LINQ (.NET Language-Integrated Query)
LINQ query examples
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈