title: Directory.GetDirectories , Sort by name C#
body: <p>This one sounds duplicate, but all the solutions given is not satisfying one of the requirement that is sorting by name. for instance</p>
  
  <pre><code>J A1
  J A2
  J A3
  J A10
  J A11
  </code></pre>
  
  <p>The method returns J A1,J A10, J A11, J A2, J A3. But this is not expected as operating system sort them in a different way.</p>
  
  <p>below solutions have tried already</p>
  
  <pre><code>var sorted = dirInfo.GetDirectories("*.*", SearchOption.TopDirectoryOnly).OrderBy(f =&gt; f.Name);
  
  Array.Sort();
  </code></pre>