开发者

How can I page my LINQ to SQL result set?

开发者 https://www.devze.com 2022-12-18 19:33 出处:网络
Remembering MySQL could use the instruction \"limit\" to indicate where I was starting my result set and how many wanted to have included.

Remembering MySQL could use the instruction "limit" to indicate where I was starting my result set and how many wanted to have included.

Select *开发者_开发百科 FROM Users Limit [start], [Length]

How can I do this in LINQ to SQL?


var limit = 10;
var start = 30;

var result = ( from x in MyList
               select x ).Skip(start)
                         .Take(limit)
                         .ToList()


You want to look up, Take and Skip.

Take and Skip

var query = listOfItems.Take("25").Skip("50");


You can see the Kigg Starter Kit for this problem and another ones

0

精彩评论

暂无评论...
验证码 换一张
取 消