Set Theoretical and Sequencing Operators
So far, we’ve just been talking about sequences as the sources of data which LINQ operates on. Even though the use of sequences implies an ordering of elements, it doesn’t preclude certain set theoretical operations, such as intersection and union, to be defined. Besides those, some operations that have an inherent affinity to sequences exist.
The intersection of two sequences consists of all the elements that exist in both of the sequences, where an existence check is based on an equality check:
static IEnumerable<T> Intersect<T>(this IEnumerable<T> first, IEnumerable<T> second);static IEnumerable<T> Intersect<T>(this IEnumerable<T> ...