title: C# Sort files by natural number ordering in the name?
body: <p>I have files in directory like that</p>
  
  <pre><code>0-0.jpeg
  0-1.jpeg
  0-5.jpeg
  0-9.jpeg
  0-10.jpeg
  0-12.jpeg
  </code></pre>
  
  <p>....</p>
  
  <p>when i loading files:</p>
  
  <pre><code>FileInfo[] files = di.GetFiles();
  </code></pre>
  
  <p>They getting in wrong order (they should go like above):</p>
  
  <pre><code>0-0.jpeg
  0-1.jpeg
  0-10.jpeg
  0-12.jpeg
  0-5.jpeg
  0-9.jpeg
  </code></pre>
  
  <p>How to fix that?</p>
  
  <p>I was trying to sort them but no way:</p>
  
  <pre><code>1) Array.Sort(files, (f1, f2) =&gt; f1.Name.CompareTo(f2.Name));
  
  2) Array.Sort(files, (x, y) =&gt; StringComparer.OrdinalIgnoreCase.Compare(x.Name, y.Name)); 
  </code></pre>