c# - Get uniques elements -
i have
int[] array1 = { 1, 2, 3 }; int[] array2 = { 2, 3, 4 }; using var intersect = array1.intersect(array2);i got
2 3 but need
1 4 can give me advice how can using linq?
array1.union(array2).except(array1.intersect(array2)) explanation:
- first calculate set union of 2 sequences:
1, 2, 3, 4 - you calculating intersection of sets:
2, 3 - you finding set difference between items , intersection:
1, 4
Comments
Post a Comment