title: Ordering a DataTable in Descending Order using Multiple Columns C#
body: <p>I want to create a method which is able to take a Datatable and order the rows in descending order via multiple columns specified. </p>
  
  <p>Below is an example of when I call the table sorting method:</p>
  
  <pre><code>t1 = getSortedTable(t1 , "Hotel Costs, Flight Cost DESC");
  </code></pre>
  
  <p>The Hotel Costs and Flight Costs are both type Double columns. The method for sorting is as below:</p>
  
  <pre><code>public static DataTable getSortedTable(DataTable dt, string sort)
      {
          DataTable newTable = new DataTable();
          newTable = dt.Clone();
          newTable.Rows.Clear();
          DataRow[] newRows = dt.Select("", sort);
          foreach (DataRow nr in newRows)
          {
              newTable.Rows.Add(nr.ItemArray);
          }
          return newTable;
      }
  </code></pre>
  
  <p>The method only returns a table with rows sorted via the Flight Cost in descending order. </p>