1 List<string> s = new List<string>() { "A", "", "", "C", "B", "C", "D", "E" };
 2 
 3             s = s.OrderByDescending(w => w == "C").ToList(); //.ThenBy(q => q).ToList();
 4 
 5 
 6 //result: C,C, A,家,帮,B,D,E
 7 
 8 CultureInfo culture = new CultureInfo("zh-cn");
 9 StringComparer cmp = StringComparer.Create(culture, false); // stringCompare.currentCulture
10             s = s.OrderByDescending(w => w == "C").ThenBy(q => q, cmp).ToList();
11 
12 
13 //result: C,C, A,B,D,E,家,帮

 

相关文章:

  • 2022-01-02
  • 2021-12-15
  • 2021-12-22
  • 2022-02-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
相关资源
相似解决方案