title: Remove Duplicates from Datatable with LINQ without keeping a duplicated entry at all
body: <p>I have a <code>Datatable</code> with several Columns which I want to remove all duplicates from like that</p>
  <pre><code>Dt1 = Dt1 .AsEnumerable().GroupBy(r =&gt; new { filename = r.Field&lt;string&gt;(&quot;filename1&quot;), filesize = r.Field&lt;string&gt;(&quot;filesizeinkb&quot;) }).Select(g =&gt; g.First()).CopyToDataTable();
  </code></pre>
  <p>However above code leaves one entry (the first one that is found) in the DataTable via the <code>Select.First</code> at the end of the LINQ code.</p>
  <p>Is there a way to remove all duplicates and keep none?</p>
  <p><strong>Edit:</strong>
  Example what the code is doing now and what it should do.</p>
  <p>Datatable with entries like that</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">Name</th>
  <th style="text-align: center;">Filesize</th>
  <th style="text-align: right;">Filename</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">One</td>
  <td style="text-align: center;">50</td>
  <td style="text-align: right;">Fileone</td>
  </tr>
  <tr>
  <td style="text-align: left;">Two</td>
  <td style="text-align: center;">50</td>
  <td style="text-align: right;">Fileone</td>
  </tr>
  <tr>
  <td style="text-align: left;">Three</td>
  <td style="text-align: center;">50</td>
  <td style="text-align: right;">Filetwo</td>
  </tr>
  <tr>
  <td style="text-align: left;">Four</td>
  <td style="text-align: center;">50</td>
  <td style="text-align: right;">Filethree</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Above LINQ will now remove Line 2 as Filename and Filesize are the same. However Line 1 will stay as the LINQ Code selects the first duplicated entry.</p>
  <p>I want to have removed line 1 and line 2 from the Datatable.</p>