title: Sort List of Strings By Version
body: <p>I have a list of strings. Each string follows the pattern "{Path}\UpdateTo{Version}-{Order}".</p>
  
  <p>I need to sort the list such that the lowest version numbers are at the top. In the case when there is multiple files with the same version number then an optional order parameter is appended. If an order is present on any of the strings then it should appear above the strings with the same version number that do not have an order number.</p>
  
  <p>For example, give the following list (note the items are randomly ordered):</p>
  
  <pre><code>var files = new List&lt;string&gt;() {
      @"C:\Migrations\UpdateTo1.2-2",
      @"C:\Migrations\UpdateTo1.5-2",
      @"C:\Migrations\UpdateTo1.2",
      @"C:\Migrations\UpdateTo1.4",
      @"C:\Migrations\UpdateTo1.1",
      @"C:\Migrations\UpdateTo1.5",
      @"C:\Migrations\UpdateTo1.2-1",
      @"C:\Migrations\UpdateTo1.5-1"
  };
  </code></pre>
  
  <p>The result would be:</p>
  
  <pre><code>var files = new List&lt;string&gt;() {
      @"C:\Migrations\UpdateTo1.1",
      @"C:\Migrations\UpdateTo1.2-1",
      @"C:\Migrations\UpdateTo1.2-2",
      @"C:\Migrations\UpdateTo1.2",
      @"C:\Migrations\UpdateTo1.4",
      @"C:\Migrations\UpdateTo1.5-1",
      @"C:\Migrations\UpdateTo1.5-2",
      @"C:\Migrations\UpdateTo1.5"
  }
  </code></pre>
  
  <p>I've been trying with all sorts of ideas but so far my attempts have been a complete mess. I'd appreciate it if someone could help. Thanks</p>