If I'm reading that right, you want the
disjunction of the two lists - all of the items which are in one of the lists, but not in both.
There isn't a built-in LINQ method to do that, but it's fairly simple to implement:
var disjunction = firstList.Except(secondList)
.Concat(secondList.Except(firstList))
.ToList();
var disjunction = new HashSet<YourType>(firstList);
disjunction.SymmetricExceptWith(secondList);
If your type doesn't implement
IEquatable<T>[
^], then you'll need to create a class which implements
IEqualityComparer<T>[
^], and pass an instance of that class as the second parameter to the
Except
method or the
HashSet<T>
constructor.