本文介绍了Linq选择记录范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
var q = (from Comments in db.tblBlogComments where Comments.blogID == this.ID orderby Comments.date descending select new {
Comments.userID, Comments.comment, Comments.date
});
这将返回我所有的关联记录,我怎么最好选择只说#10到#20记录,这样我才不会加载任何冗余数据?
This returns ALL my associated records, how best would I select say records #10 to #20 only so I don't load any redundant data?
推荐答案
怎么样:
var q = (
from Comments in db.tblBlogComments
where Comments.blogID == this.ID
orderby Comments.date descending
select new { Comments.userID, Comments.comment, Comments.date }).Skip(10).Take(10);
这篇关于Linq选择记录范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!