title: How to order a list in ascending order by it's name c#
body: <p>I have this function that takes a list and needs to order it in ascending order by the name, I've taken the query from a previous function, but now Im stuck on what I have to change to make it work beacuse I don't know Linq, this is the function:</p>
  <pre><code>private void OrderList(List&lt;string&gt; ListaFiles)
  {
     List&lt;string&gt; list = ((IEnumerable&lt;string&gt;)Directory.GetFiles(Directories, &quot;*.sql&quot;, SearchOption.TopDirectoryOnly)).Select(f =&gt;
      {
        string[] strArray = Path.GetFileName(f).Split('_');
        int result;
        if (strArray.Length &lt; 1 || !int.TryParse(strArray[0], out result))
            result = -1;
        var data = new
        {
          File = f,
          Version = result
        };
        return data;
        }).Where(f =&gt; f.Version &gt; -1).OrderBy(f =&gt; f.Version).Select(f =&gt; f.File).ToList&lt;string&gt;();
  }
  </code></pre>
  <p>I only want to select from the list so the <code>((IEnumerable&lt;string&gt;)Directory.GetFiles(Directories, &quot;*.sql&quot;, SearchOption.TopDirectoryOnly))</code> isn't necessary.</p>
  <blockquote>
  <p>I want to order the list that I pass to the function as a parameter, and the files are named like this: 1_ORCA_3-9_56.sql the first number represents the execution order of the files, so I need to sort the files by that name ascending</p>
  <p>I will actually be passing a struct that contains 3 lists that need to be sorted</p>
  <p>The files name are full path</p>
  </blockquote>