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