Comparing data from two data tables

I have this code which compares data from two data tables. It does this by using a primary column and inserting the new record from table2 to table1. This loop continues for a large number of tables. I want to optimize it. Kindly give suggestions.

foreach (DataRow drRow in table2.Rows)
{
if(!table1.Rows.Contains(drRow["KeyId"]))
{
table1.ImportRow(drRow);
}
}

• What version of .net framework is being used ? – Purnil Soni Oct 25 '13 at 7:33
• Hi purnil, its 3.5 – rrk Oct 25 '13 at 8:22
• I think that this might be the best way to do it. I have done a little bit of looking and it seems like the other ways that I have thought about doing it fall short of this code. – Malachi Oct 25 '13 at 13:50
• Malachi, thanks a lot for looking into it. I too trying to find other way which will be more optimized. – rrk Oct 28 '13 at 4:39

foreach (var drRow in table2.Rows.Cast<DataRow>()