这是我的代码,为简单起见,严重缩写
Func<Product, bool> selector;
...
selector = p => p.IsNew;
...
if(negative) // not selector
selector = x => !selector(x); // This is wrong (causes infinite loop)
// How do you do negate it? The result should be p => !p.IsNew
...
IEnumerable<Product> products = MyContext.Products.Where(selector);