2012-10-17 303 views
1

我需要通過以下方式LINQ2SQL排序順序

DTO{ 
    id //nullable 
    name // not nullable 
} 

demodata 
entry1: Null/"TopItem" 
entry2: 1 /"Numer1" 
entry2: 3 /"Numer3" 
entry2: 2 /"Numer2" 

說我必須在上面標識爲null,列名排序的所有其他條目的項目訂購一些數據

能這樣用LINQ2SQL完成?

回答

1

嘗試這樣:

from dto in context.DTO 
orderby !dto.id.HasValue, dto.name 
select dto 
+0

作品。太好了,謝謝 –