[英]LINQ query the most recent records
How to modify this query to be able to select the 5 most recent records sorted by title? 如何修改此查询以便能够选择按标题排序的5个最新记录?
IEnumerable<Story> recentStories =
(from s in stories
orderby s.Date descending
select s).Take(5);
IEnumerable<Story> recentStories =
(from s in stories
orderby s.Date descending
select s).Take(5).OrderBy(s => s.Title);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.