title: Best way to copy Data from one DataTable to another DataTable with diffrent structure
body: <p>I am copying data from DataTable to another DataTable with a structure.
  I have to hardcode columns number in the loop and copy the data in object array.</p>
  
  <p>What will be the best way to achieve it ?</p>
  
  <pre><code>IEnumerable&lt;DataRow&gt; query = from vendInv in VendorInvoiceStagingTable.AsEnumerable()
                               where vendInv.Field&lt;string&gt;(VendInvoice.Number) == InvoiceHeader
                               select vendInv;
  
  Object[] obj = new Object[10];
  var item = query.First();
  
  for (int idx = 0; idx &lt; 10; idx++)
  {
      obj[idx] = item[idx];
  }
  
  VendorInvoiceTable.Rows.Add(obj);
  </code></pre>