C# - Merge two DataTables where rows are duplicate

后端 未结 1 1188
醉梦人生
醉梦人生 2020-12-21 09:30

I can find lots of information about merging two DataTables and dropping duplicate rows, but I need the opposite.

I need to know if anyone has an easy way to merge t

相关标签:
1条回答
  • 2020-12-21 10:11

    Like this:

    var intersection = table1.AsEnumerable()
                             .Intersect(table2.AsEnumerable(), DataRowComparer.Default);
    

    DataRowComparer compares rows by their column values.

    0 讨论(0)
提交回复
热议问题