Filter Linq EXCEPT on properties
Try a simple where query
var filtered = unfilteredApps.Where(i => !excludedAppIds.Contains(i.Id));
The except method uses equality, your lists contain objects of different types, so none of the items they contain will be equal!
ColinE's answer is simple and elegant. If your lists are larger and provided that the excluded apps list is sorted, BinarySearch<T>
may prove faster than Contains
.
EXAMPLE:
unfilteredApps.Where(i => excludedAppIds.BinarySearch(i.Id) < 0);