In LINQ, is it possible to have conditional orderby sort order (ascending vs. descending).
Something like this (not valid code):
bool flag;
(from w in widgets
where w.Name.Contains("xyz")
orderby w.Id (flag ? ascending : descending)
select w)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…