fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static int count;
  7. public static string GetKey(string t) {
  8. Test.count++;
  9. return t.ToLower();
  10. }
  11. public static void Main() {
  12. var rand = new Random();
  13. var unsorted = Enumerable
  14. .Repeat(0, 10000)
  15. .Select(i => rand.Next(-100000, 100000).ToString())
  16. .ToArray();
  17. //var unsorted = new string[] { "the", "Schwartzian", "Transform", "rocks"};
  18. var sorted = unsorted
  19. .OrderBy(Test.GetKey)
  20. .ToArray();
  21. Console.WriteLine(sorted);
  22. Console.WriteLine(Test.count);
  23. }
  24. }
Success #stdin #stdout 0.33s 24280KB
stdin
Standard input is empty
stdout
System.String[]
10000