linq multiple order DESCENDING
Posted
by ile
on Stack Overflow
See other posts from Stack Overflow
or by ile
Published on 2010-06-18T09:43:25Z
Indexed on
2010/06/18
9:53 UTC
Read the original article
Hit count: 291
.OrderBy(y => y.Year).ThenBy(m => m.Month);
How to set descending
order?
EDIT:
I tried this:
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)
;
And it seems working. Is it wrong to use orderby
twice like I used it here?
© Stack Overflow or respective owner