title: Fetch distinct record from datatable using linq to datatable and shows all columns of datatable
body: <p>I am fetching record from database and store a result in dataset.</p>
  
  <p>My dataset like this</p>
  
  <pre><code>Sid Table userid par1 par2 par3
  274 tbl1  43     0    0    0
  232 tbl1  43     1    2    0
  232 tbl1  43     1    2    1
  232 tbl2  43     1    2    0
  232 tbl2  43     1    2    1
  </code></pre>
  
  <p>I want to show all 6 column but distinct record.Distinct should be on Sid, Table and userid.I want output like this</p>
  
  <pre><code>Sid Table userid par1 par2 par3
   274 tbl1  43     0    0    0
   232 tbl1  43     1    2    0
   232 tbl2  43     1    2    0
  </code></pre>
  
  <p>So Used following query.I am new to linq.</p>
  
  <pre><code>Datatable.Rows.Cast&lt;DataRow&gt;()
  .GroupBy(r =&gt; new { Sid = r.Field&lt;int&gt;("Sid"), userid = r.Field&lt;int&gt;("userid"), Table = r.Field&lt;string&gt;("Table") })
  .Select(e =&gt; e.FirstOrDefault())
  .Select(grp =&gt; new
  {
      Sid = grp.Field&lt;int&gt;("Sid"),
      userid = grp.Field&lt;int&gt;("userid"),
      Table = grp.Field&lt;string&gt;("Table"),
      par1 = grp.Field&lt;int&gt;("par1"),
      par2 = grp.Field&lt;int&gt;("par2"),
      par3 = grp.Field&lt;int&gt;("par3")
  });
  </code></pre>
  
  <p>My columns are dynamic in nature.some user have par2,some 1 like that.Is there  any way to select all column instead of specifying column names?</p>