Last and LastOrDefault not supported

后端 未结 7 1048
孤独总比滥情好
孤独总比滥情好 2020-12-03 09:47

I am trying to get the first and last values in a list. The query operator First() is supported but Last() and LastOrDefault() give an

相关标签:
7条回答
  • 2020-12-03 10:16

    The problem is that there's no easy translation into SQL for Last or Reverse, so either convert it to something in memory (ToList, ToArray) if there aren't going to be too many records, or you could run the query a 2nd time, with OrderByDescending instead of OrderBy and use First.

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