2011-03-17 38 views
1

我想通過IsTop財產上升對象,然後通過JobId屬性降序:query = query.OrderBy(p => p.IsTop).ThenOrderByDescending(p => p.JobId)?

query = query.OrderBy(p => p.IsTop).ThenOrderByDescending(p => p.JobId); 

我該怎麼辦呢?我知道相反:

query = query.OrderByDescending(p => p.IsTop).ThenBy(p=>p.JobId) 

語法的作品,但它不是我想要的。我想要的是實際上IsTop的任何情況都會在頂部!

+0

是否查詢= query.OrderBy(p => p.IsTop).ThenByDescending(p => p.JobId)不起作用? – 2011-03-18 00:04:31

回答

2
query = query.OrderBy(p => p.IsTop).ThenByDescending(p => p.JobId); 
3

Bool按升序排序爲false,爲true。

Try: query.OrderByDescending(p => p.IsTop).ThenByDescending(p => p.JobId);

相關問題