I have two string arrays containing file names. From those two arrays, I need to produce a third string array that contains only the file names that are unique (i.e., found in one array, but not in both arrays).
2 Answers
var elements = array1.Union(array2).Except(array1.Intersect(array2));
4 Comments
Strax Tillbaka
The coders on StackOverflow also never cease to amaze!
Adam Houldsworth
@grant probably because of the Except call. It isn't needed.
jdphenix
Read the spec, @StraxTillbaka basically wants XOR on an array, `A⊕B == (A AND B) NOT (A OR B), Lee's code does exactly that
Adam Houldsworth
@jdpenix true, I paid too nuch attention to the unique description, not the ie bit :-)