title: Sorting a DataTable using LINQ, when sort-by-columns may vary
body: <p>I need to sort DataTables, however the sort-by-columns vary.</p>
  
  <p>Scenario #1, DataTable1 should be sorted by "Column1".</p>
  
  <p>Scenario #2, DataTable2 should be sorted by "Column1, Column2".</p>
  
  <p>Below is my first attempt at creating a helper function for this purpose. This works ok.</p>
  
  <pre><code>Private Sub SortDataTable(ByRef dataTable As DataTable, ByVal sortColumnNames As List(Of String))
      'Validation (not shown here)
  
      Dim sortOrder = String.Join(", ", sortColumnNames)
  
      dataTable.DefaultView.Sort = sortOrder
      dataTable = dataTable.DefaultView.Table
  End Sub
  </code></pre>
  
  <p>I tried implementing this in LINQ, however, I don't know how to pass multiple sort-by-columns to the lambda function. Work-in-progress code shown below.</p>
  
  <pre><code>Private Sub SortDataTable(ByRef dataTable As DataTable, ByVal sortColumnNames As List(Of String))
          'Validation (not shown here)
  
          dataTable.AsEnumerable().OrderBy(Function (row) row(sortColumnNames(0))).ThenBy(...)
      End Sub
  </code></pre>
  
  <p>How should I pass multiple sort-by-columns to the OrderBy/ThenBy extension methods?</p>