linq中的orderby子句

linq中的orderby子句,linq,Linq,我有这个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/

我有这个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

我们是在内存中讨论Linq,还是在数据库中讨论Linq?(Linq2NHibernate/Linq2SQL/Linq2EF…?@mikesmith,显示您的输入和输出,并说明您认为这不起作用的原因?我知道有什么异常或不想要的结果吗?如果是这样,请告诉我们。另外,您的
LocalDateTime
的类型是什么?
from d in Devices

where d.Name=="switch01"

orderby d.Performance.system.io.LocalDatetime 

select new {d.deviceId, Performance=d.Performance.system.io}