fork(35) download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var list = new List<string>() { "50:James", "23:Jessica", "70:Ricky", "70:Dodger", "50:Eric" };
  10. var ordered = list.Select(s => new { Str = s, Split = s.Split(':') })
  11. .OrderByDescending(x => int.Parse(x.Split[0]))
  12. .ThenBy(x => x.Split[1])
  13. .Select(x => x.Str)
  14. .ToList();
  15. foreach(string s in ordered)
  16. Console.WriteLine(s);
  17. }
  18. }
Success #stdin #stdout 0.07s 34048KB
stdin
Standard input is empty
stdout
70:Dodger
70:Ricky
50:Eric
50:James
23:Jessica