Except

How do you find elements in an array or list in one and not the other? The Except Linq operation is the way to go.

Basic example

Take, for instance, I have an array of numbers set1 where they are in increments of 10, following by another array set2 where they are in increments of 5. Then I call the Except method, I should only get the numbers that appear in set1 only and not in set2.

Live example: https://dotnetfiddle.net/Qqiyi2

var set1 = new[] { 10, 20, 30, 40, 50, 60 };
var set2 = new[] { 5, 10, 15, 20, 25, 30, 35 };

var result = set1.Except(set2);

//output: 40, 50, 60