开发者

EF Max on Record By Value

I want to get the maximum record based on a field, but the Max() extension returns that given type. Say this:

o.Max(i => i.CreatedDate) // returns date

Returns the maximum date value; I want to return the record itself like:

o.Max(i => i.CreatedDate) // returns the record with the ma开发者_JAVA百科ximum condition

Is there a method to do this?

Thanks.


o.OrderByDescending(i => i.CreatedDate).First()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜