IEnumerable vs IQueryable

后端 未结 4 1684
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-23 15:30

I have a query:

topics.OrderBy(x => x.Replies.Any() ? x.Replies.OrderBy(y => y.PostedDate).Last().PostedDate : x.PostedDate);

It sorts th

4条回答
  •  深忆病人
    2021-01-23 16:14

    Have you tried topics.OrderBy(x => x.Replies.Any() ? x.Replies.Max(y => y.PostedDate) : x.PostedDate);?

提交回复
热议问题