fork 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. .OrderBy(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.05s 31072KB
stdin
Standard input is empty
stdout
23:Jessica
50:Eric
50:James
70:Dodger
70:Ricky