title: convert linq query results to datatable C#
body: <p>I want to convert the linq query results to datatable so that I can assign datatable to GridView to show it on asp page.</p>
  
  <p>However I am not able to convert the results to datatable, I am not getting CopyToTable() method in my code.</p>
  
  <p>please advise what am I doing wrong here?</p>
  
  <pre><code> var gradeData = (from data in oAngieCtxt.prc_ShopInstanceCustomersData(Convert.ToInt32(this.ShopInstanceID), 10000, false)
                       .Where( row =&gt; row.RecievedPoints != "n/a" )
                      .GroupBy(row =&gt; new { row.Name })
                      .Select(g =&gt; new GroupedPoints()
                      {
                          Name = g.Key.Name,
                          TotalPoints = g.Sum(x =&gt; Convert.ToDouble(x.RecievedPoints) * (x.Weightage.ToString() == "0.00" ? 1 : Convert.ToDouble(x.Weightage)))
                      })
                       select data).ToList();
  
   DataTable dt = gradeData --gradeData.CopyToTable()
  </code></pre>
  
  <p>Note: reference to dataextentions dll is available.</p>
  
  <p>Thanks in advance</p>