How do you filter when the collection should contain all of the values in the array
var andAttributes = "super-quiet,electric-start".Split(',');
var andx = gg.Where(x => x.ProductAttributes.All(pa => andAttributes.Contains(pa.AttributeId)));
the above seems like it would work but doenst seem to.
For the given example, productAttributes
is a generic list that may contain 1 or more specific values.
In english, i want to select only the objects that contain both the super-quiet AND electric-start values in the productAttributes
collection.
This expression acts like an OR statement
var orx = gg.Where(x => x.ProductAttributes.Any(pa => orAttributes.Contains(pa.AttributeId)));