Remove matched Rows from two Datatable Here I have two DataTables:


dtTotalDateRangeExcludeSundays  
dtAbsentsLeavesHolidaysWorks


Each has 10k+ values, and I need to delete matched rows.

foreach (DataRow rw in dtTotalDateRangeExcludeSundays.Select())
 {
    DateTime dateFromRange=Convert.ToDateTime(rw[0].ToString());
    string strPrnt = dateFromRange.ToShortDateString();
    foreach (DataRow row in dtAbsentsLeavesHolidaysWorks.Select())
    {
      DateTime getDate = Convert.ToDateTime(row[0].ToString());
      string strchild = getDate.ToShortDateString();
       if (strPrnt == strchild)
       {
          rw.Delete();
        }
       }
 }


I want to know if any better alternative suggestion, because the foreach loop takes time when bulk data is there.  I am not good with Linq, so I want to know if any Linq tricks work.
Assuming that you load the data into your DataTable instances from database, it's better to issue a direct DELETE FROM ... query over database rather than iterate on a client.

As a side note - it is an awful practice to compare dates by comparing strings. If your table has a DateTime column it's much better to cast the value to DateTime and compare typed dates like that:

DateTime dateFromRange = ((DateTime)rw[0]).Date;
....

    DateTime getDate = ((DateTime)row[0]).Date;
    if (dateFromRange == getDate)
....