Linq to SQL-返回前n行


Answers:



57

您想使用Take(N);

var data = (from p in people
           select p).Take(100);

如果还想跳过某些记录,则可以使用“跳过”,它将跳过前N个数字:

var data = (from p in people
           select p).Skip(100);


1

使用Take()扩展

例:

var query = (from foo in bar).Take(100)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.