20
.OrderBy(y => y.Year).ThenBy(m => m.Month);
如何設置descending
命令?linq multiple order DESCENDING
編輯:
我嘗試這樣做:
var result = (from dn in db.DealNotes
where dn.DealID == dealID
group dn by new { month = dn.Date.Month, year = dn.Date.Year } into date
orderby date.Key.year descending
orderby date.Key.month descending
select new DealNoteDateListView {
DisplayDate = date.Key.month + "-" + date.Key.year,
Month = date.Key.month,
Year = date.Key.year,
Count = date.Count()
})
//.OrderBy(y => y.Year).ThenBy(m => m.Month)
;
,似乎工作。使用orderby
兩次就像我在這裏使用的那樣是錯誤的嗎?
很好,謝謝:)我編輯了我的問題,可否請你看看 – 2010-06-18 09:49:31