Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 11th, 2013  |  syntax: None  |  size: 0.50 KB  |  views: 53  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. 192.168.1.5
  2. 69.52.220.44
  3. 10.152.16.23
  4. 192.168.3.10
  5. 192.168.1.4
  6. 192.168.2.1
  7.        
  8. 10.152.16.23
  9. 69.52.220.44
  10. 192.168.1.4
  11. 192.168.1.5
  12. 192.168.2.1
  13.        
  14. var unsortedIps =
  15.     new[]
  16.     {
  17.         "192.168.1.4",
  18.         "192.168.1.5",
  19.         "192.168.2.1",
  20.         "10.152.16.23",
  21.         "69.52.220.44"
  22.     };
  23.  
  24. var sortedIps = unsortedIps
  25.     .Select(Version.Parse)
  26.     .OrderBy(arg => arg)
  27.     .Select(arg => arg.ToString())
  28.     .ToList();
  29.        
  30. 69.52.220.44 =>
  31.  
  32. 69 * 255 * 255 * 255 +
  33. 52 * 255 * 255 +
  34. 220 * 255 +
  35. 44