1
我有一个查询,看起来像这样:LINQ到SQL排序依据,选择空条目
var TheOutput = from u in MyDC.TheTable
where ....
orderby u.TheDateTimeUsed
select new MyModel()
{
....
TheDateCreated = u.TheDateTimeCreated,
TheDateUsed = u.TheDateTimeUsed
...
};
return TheOutput.Take(10).ToList();
u.DateTimeUsed是一个可空日期。如果该值为空,那么我希望这些记录首先出现在我加载的10列表中。
我怎样才能做到这一点?
谢谢。
可能的重复 - http://stackoverflow.com/questions/1107767/ordering-nullable-datetime-in-linq-to-sql – 2012-04-07 14:06:53