DataRow Set Operators

As you may recall, in the LINQ to Objects API, there are a handful of Standard Query Operators that exist for the purpose of making sequence set-type comparisons. I am referring to the Distinct, Except, Intersect, Union, and SequenceEqual operators. Each of these operators performs a set operation on two sequences.

For each of these set-type operators, determining sequence element equality is necessary to perform the appropriate set operation. These operators perform element comparisons by calling the GetHashCode and Equals methods on the elements. For a DataRow, this results in a reference comparison, which is not the desired behavior. This will result in the incorrect determination of element equality, thereby causing ...

Get Pro LINQ: Language Integrated Query in C# 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.