Paging with LINQ for objects
问题 How would you implement paging in a LINQ query? Actually for the time being, I would be satisfied if the sql TOP function could be imitated. However, I am sure that the need for full paging support comes up sooner later anyway. var queryResult = from o in objects where ... select new { A = o.a, B = o.b } ????????? TOP 10???????? 回答1: You're looking for the Skip and Take extension methods. Skip moves past the first N elements in the result, returning the remainder; Take returns the first N