title: Convert resultset in to Datatable
body: <p>How can I convert the result of a LINQ query where I select some columns of a <code>DataTable</code> to a <code>DataTable</code> again?</p>
  
  <pre><code>DataTable dtN = new DataTable();
  
  dtN.Columns.Add("Id");   
  dtN.Columns.Add("Name");
  dtN.AcceptChanges();
  
  for (int i = 1; i &lt;= 10; i++)
  {
      DataRow dr = dtN.NewRow();
      dr["Id"] = i;  
      dr["Name"] = "A"+i.ToString();
      dtN.Rows.Add(dr);
      dtN.AcceptChanges();
  }
  
  var data = from r in dtN.AsEnumerable()
             select new { Name = r["Name"].ToString() };
  
  //this line is giving error because CopyToDatatable is not available
  DataTable dt = data.CopyToDataTable();
  </code></pre>