The following query works if a list of related products is retrieved using EF in the previos query.
var temp = db.Products.ToList().Except(associatedProducts).ToList();
otherwise, if associatedProducts is a list that was not selected using EF (it is assumed that Key is an integer);
List<int> tempIdList = associatedProducts.Select(q => q.Key ).ToList(); var temp = db.Products.Where(q => !tempIdList.Contains(q.Key));
daryal
source share