CipherIS
asked on
C# Linq - Not In
I have two data sets. I want to link them together but select the data by filtering the data.
So, if
Data 1 contains A, B, C
and
Data 2 contains B, C, D
The result should return only A.
So, I did something like this.
var data = (from data1 in firstdata where data1.description == value select data1).ToList();
Now I'm trying to get the delta between the two.
var delta = (from data2 in seconddata where !data2.description.Contain s (
from x in data select x.description
) select data2).ToList();
I am getting an error on the second line.
So, if
Data 1 contains A, B, C
and
Data 2 contains B, C, D
The result should return only A.
So, I did something like this.
var data = (from data1 in firstdata where data1.description == value select data1).ToList();
Now I'm trying to get the delta between the two.
var delta = (from data2 in seconddata where !data2.description.Contain
from x in data select x.description
) select data2).ToList();
I am getting an error on the second line.
ASKER
Exception is not an option.
Why is "Except" not an option?
Please be more specific about the data types contained in firstdata and seconddata, as well as the desired output data type.
Please be more specific about the data types contained in firstdata and seconddata, as well as the desired output data type.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I came up with something similar.
var exception = delta.Where(x = x> !data.Any(x2 => x2.Description == x.Description))
Let me know if you disagree.
Thanks.
var exception = delta.Where(x = x> !data.Any(x2 => x2.Description == x.Description))
Let me know if you disagree.
Thanks.
Open in new window