Hi there. Imagine you would want to select all elements of one sequence all, except elements contained in sequence exceptions and single element otherException.
Is there some better way to do this than? I'd like to avoid creating new array, but I couldn't find a method on the sequence that concats it with a single element.
all.Except(exceptions.Concat(new int[] { otherException }));
complete source code for completeness' sake:
var all = Enumerable.Range(1, 5);
int[] exceptions = { 1, 3 };
int otherException = 2;
var result = all.Except(exceptions.Concat(new int[] { otherException }));