title: Compare datatable and return rows with changes
body: <p>I am trying to compare two datatable and return only rows which has changes. In the below code I am cloning dt2 into dt3 but it doesn't pick the rows with changes instead it puts everything in there. Pls suggest some options.</p>
  
  <p>Even if a single cell value is modified then I need to pick that row. Both datatable with have same set of rows and column each time I compare.</p>
  
  <pre><code> Table 1              Table 2
  
  ID   Name             ID     Name
  
  1    Mark             1      Mark
  
  2    Spencer          2      Spencer     
  
  3    Ryan             3      George  
  </code></pre>
  
  <p><strong>Table 3 Expected Result:</strong></p>
  
  <pre><code>ID     Name
  
  3      George
  </code></pre>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>DataTable dt3 = new DataTable();
  // It will compare the 2nd table with the 1st table
  var contacts = dt2.AsEnumerable().Except(dt1.AsEnumerable(), DataRowComparer.Default); 
  dt3 = dt2.Clone();
  foreach (DataRow rows in contacts)
   {
      dt3.ImportRow(rows);
   }
  </code></pre>