I have two list of A
and B
and trying to get elements from A
which are not in B
and from B
which are not in A
.
Below is my attempt to solve this.
var result = (List<string>)(from e in (A.Concat(B))
where !B.Contains(e) || !A.Contains(e)
select e);
And ran into below error..
Unable to cast object of type WhereEnumerableIterator1[System.String] to type System.Collections.Generic.List`1[System.String].
What can I try to solve this?