Skip to content

Instantly share code, notes, and snippets.

@pjmagee
Created June 28, 2013 06:42
Show Gist options
  • Select an option

  • Save pjmagee/5882908 to your computer and use it in GitHub Desktop.

Select an option

Save pjmagee/5882908 to your computer and use it in GitHub Desktop.
string name = "patrick";
var sw = Stopwatch.StartNew();
// LINQ
name = string.Concat(name.OrderBy(c => c));
sw.Elapsed.Dump("OrderBy: " + name);
// Array.Sort
sw = Stopwatch.StartNew();
char[] arr = name.ToCharArray();
Array.Sort(arr);
name = new String(arr);
sw.Elapsed.Dump("Array.Sort: " + name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment