This question is very similar to this one: Use LINQ to get items in one List<>, that are not in another List<>. But the differences are just enough that I'm having trouble nailing down the LINQ syntax.
I have two lists:
List<Fubar> fewBarNew
List<string> existingProviderIDs
Where Fubar
looks like:
Class Fubar
{
int FunbarId int {get; set;}
....
....
string ProviderID {get; set;}
}
Now, I want to remove from fewBarNew
any instance where FewBarNew.ProviderID
exists inside existingProviderIDs
.
fewBarNew = fewBarNew.Where(f => !existingProviderIdList.Any(ep => ?????).ToList();