Intersect, Union, and Except Methods
Explore how to use LINQ methods Intersect Union and Except to compare collections in C#. Learn to find common elements combine unique items and identify differences between lists and arrays for more efficient data manipulation.
How to find the intersection between two collections
The Intersect method finds the common elements between two collections.
Let’s find the movies we both have watched and rated in our catalogs.
Notice that, this time, we have two lists of movies, mine and yours, with the ones I’ve watched and the ones I guess you have watched, respectively.
To find the movies we both have seen (the intersection between our ...