LINQ Using Max() to select a single row

前端 未结 6 1441
轻奢々
轻奢々 2020-12-02 16:13

I\'m using LINQ on an IQueryable returned from NHibernate and I need to select the row with the maximum value(s) in a couple of fields.

I\'ve simplified the bit tha

6条回答
  •  执念已碎
    2020-12-02 17:01

    You can also do:

    (from u in table
    orderby u.Status descending
    select u).Take(1);
    

提交回复
热议问题