Finding the intersection of two .NET DataTables -


Is there a simpler way to achieve the intersection of two data tables?

I can do Think about the obvious methods (O (N ^ 2) being repeated on both tables), but I have to show this something more beautiful if it is available. I suspect that there can be such a wise method which I am not seeing

Any good thoughts?

Edit: It seems Brian Watts is a very good solution for 3.5, but unfortunately I am in .NET 2.0 (which I should mention.)

with .NET 3.5:

  using System.Data; Public Static Class Datatile Extensions {Public Fixed IEnumerable & lt; DataRow & gt; Hide (this data table, datatyel other) {return table.fifty (). Cutting (other .na numeric ()); } Public stable IEnumerable & lt; DataRow & gt; Hide (The DataTable Table, Datatale Other, IQquity Comparator & lt; DatArea & gt; Comparator) {Return Table ANA numeric () Cutting (other. ANMMereable (comparative)); }}  

Comments