I have the following object:
Line{ String Content; Type type;}
And I have, IQeryable
lines, which I perform operation
lines
is IQeryable<Line>
. If you do not save its result, it will run every time you select from it. If Line
does not override Equals
and ==
, that will create different objects each time, so Except
cannot remove the previous object from new objects.
Now, a lot is missing, but try:
var linesList = lines.ToList(); // get results ones
var hasX = lines.Where(line => line.Content.Contains('x'));
var noX = lines.Except(hasX);
Alright. All I needed to do is to implement IEqualityComparer<T>
in Line
class.