Alternative way to do FirstOrDefault in LINQ

前端 未结 1 936
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-23 11:08

I\'ve got a membership table that records whether a user is a member of a list. When an update to a user\'s membership occurs a new record is written and the previous records ar

相关标签:
1条回答
  • 2021-01-23 11:23

    Without posting code it's hard for anyone to see what your issue is.

    Are you not able to just order the results by your date field and then select the first record? Something like users.OrderByDescending(u => u.Inserted).FirstOrDefault()?

    0 讨论(0)
提交回复
热议问题