EF - order by specific values

Posted h.yl

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了EF - order by specific values相关的知识,希望对你有一定的参考价值。

 

List<string> s = new List<string>() { "A", "B", "A", "C", "B", "C", "D", "E" };

            s = s.OrderByDescending(w => w == "C").ToList(); //.ThenBy(q => q).ToList();

//result: C,C, A,B,A,B,D,E

            s = s.OrderByDescending(w => w == "C").ThenBy(q => q).ToList();


//result: C,C, A,A,B,B,D,E

 

以上是关于EF - order by specific values的主要内容,如果未能解决你的问题,请参考以下文章