I have 2 lists of different objects (foo
& bar
) that share the same property lets call it id
.
public List<foo> foo { get; set; }
public List<bar> bar { get; set; }
I want to remove all objects from foo
that have an id that does not exist in bar
How can this be done in linq? I have been looking at Intersect
, RemoveAll
& Join
but cannot find any example where the lists are of a different type.