Sometimes you want to use a Difference (or Minus) set operation which goes like this: Give me all elements from set A that do not exist in set B. Or simply put A – B. The LINQ Except method does this if both sets A and B are of the same type, but frequently the sets are of different types and must have their identifiers matched. Here is a quick little example of how to do this with LINQ.
Wolfram MathWorld shows the operation’s definition as:
Sarah Josiah Carolin
The dot notation way of doing this would be "names.Where(a => !visiting.Select(b => b.Key).Contains(a))". I realize this all seems to be relatively trivial for one familiar with LINQ, but at the time of writing this there isn’t a decent topic popping up on Bing or Google when searching for LINQ Minus C# with two types of sets, now hopefully there will be. If you know of a more efficient way, please by all means post a comment, thanks.