max date record in LINQ

后端 未结 6 1290
一个人的身影
一个人的身影 2021-02-03 21:35

I have this table named sample with these values in MS Sql Server:

 ID    Date    Description
1    2012/01/02 5:12:43    Desc1
2    2012/01/02 5:12:48    Desc2
3         


        
6条回答
  •  迷失自我
    2021-02-03 22:24

    var result= Sample.OrderByDescending(k => k.ID).FirstOrDefault().Date;
    

    This is the best way to do this

提交回复
热议问题