I have the following object:
Line{ String Content; Type type;}
And I have, IQeryable<Line> lines, which I perform operations against. I selected certain lines where line.Content.Contains('x') = list1, and now am trying to get to the rest of the lines i.e. lines – list1 and for this am using
list2 = lines.Except(list1);
but that results in list2 = lines.
Code:
private
IQueryable<Line>
ExtractLines(
IQueryable<Line> allLines,
String keyword,
ref IQueryable<Line> hits)
{
hits = allLines.Where(lx => lx.Content.Contains(keyword));
return allLines.Except(hits);
}
any ideas?
linesisIQeryable<Line>. If you do not save its result, it will run every time you select from it. IfLinedoes not overrideEqualsand==, that will create different objects each time, soExceptcannot remove the previous object from new objects.Now, a lot is missing, but try: