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()
精彩评论