我用这段代码抓取文章。
List<view_M04FrontpagesEntity> fList = new view_M04FrontpagesService().GetByCategoryId(0);
var article = new M02ArticlesService().GetById(fList.First<view_M04FrontpagesEntity>().M02ArticleId);
我想用最新的 article.UpdatedDate
获取文章,如何最好地使用 linq 或其他方法做到这一点?
最佳答案
使用 MaxBy
方法提供我的 MoreLinq
List<view_M04FrontpagesEntity> fList = new view_M04FrontpagesService().GetByCategoryId(0);
var newest = fList.MaxBy(article => article.UpdatedDate);
关于c# - 根据最新的日期时间获取列表项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15409382/