小编kri*_*rao的帖子

如何在单个LinQ查询中编写OrderByDescending和where子句

我想展示UpdateDevice一个特定的最新价值DeviceId.使用OrderByDescending和编写LinQ查询时Where,我收到错误

无法执行文本选择:CS1061'int'不包含'OrderByDescending'的定义,并且没有可以找到接受类型'int'的第一个参数的扩展方法'OrderByDescending'

数据类型

Id - int32
UpdatedDate- datetime
Run Code Online (Sandbox Code Playgroud)

LinQ中

from a in Attendances
where a.DeviceId == 1 
.OrderByDescending(x=>x.Id)
.Take(1)
select a.UpdatedDate
Run Code Online (Sandbox Code Playgroud)

c# linq

0
推荐指数
1
解决办法
80
查看次数

标签 统计

c# ×1

linq ×1