0
kicks
LINQ Farm: More on Set Operators
This is a second post on the LINQ Set operators, the first being published while LINQ was still in beta. As mentioned in the previous post, there are four LINQ set operators: Union, Intersect, Distinct and Except. Like the other 50 LINQ operators, these methods are designed to allow you to query data which supports the IEnumerable<T> interface. Since all LINQ query expressions, and most LINQ queries, return IEnumerable<T>, these operators are designed to allow you to perform set operations on the results of a LINQ query. In this post I give four highly simplified examples of how to use each of the operators, and then end with a more complex example that shows how the operators might be used in a real world setting.