How can I limit the number of results from an e开发者_StackOverflowxtension method on a linq query?
var results = db.table.where(a=>a.Id > 500).Limit(10)???
Use IEnumerable.Take
var results = db.table.where(a=>a.Id > 500).Take(10)
Side note
If you want to implement paging there is also IEnumerable.Skip
that can be used to "fast forward" a number of records. Then use like this
.Skip(pageNo * pageSize).Take(pageSize)
精彩评论