I know in normal Linq grammar, orderby xxx descending is very easy, but how do I do this in Lambda expression?
orderby xxx descending
As Brannon says, it's OrderByDescending and ThenByDescending:
OrderByDescending
ThenByDescending
var query = from person in people orderby person.Name descending, person.Age descending select person.Name;
is equivalent to:
var query = people.OrderByDescending(person => person.Name) .ThenByDescending(person => person.Age) .Select(person => person.Name);
1.4m articles
1.4m replys
5 comments
57.0k users