我有这个linq语法,我想通过基于LocalDateTime字段
的结果来排序from d in Devices
where d.Name=="switch01"
select new {d.deviceId, Performance=d.Performance.system.io}
LocalDatetime是io的属性。我可以得到结果,但不是按日期和时间排序。
LocalDateTime类型DateTime这里是输出:
LocalDateTime Value
3/9/2012 1:05 5000.7
3/9/2012 1:15 4775.6
3/9/2012 1:35 3743.3
3/9/2012 9:05 656.3
3/9/2012 7:45 670.4
3/9/2012 10:15 621.7
3/9/2012 7:15 665.4
3/9/2012 7:10 603.9
答案 0 :(得分:3)
from d in Devices
where d.Name=="switch01"
orderby d.Performance.system.io.LocalDatetime
select new {d.deviceId, Performance=d.Performance.system.io}