title: linq how to select a parent with a child collection that contains all of an array (or list) of values
body: <p>similar to <a href="https://stackoverflow.com/questions/7890117/linq-how-to-select-a-parent-with-a-child-collection-that-contains-one-or-many-of">linq how to select a parent with a child collection that contains one or many of an array (or list) of values</a></p>
  
  <p>How do you filter when the collection should contain all of the values in the array
  </p>
  
  <pre><code>var andAttributes = "super-quiet,electric-start".Split(',');
  
  var andx = gg.Where(x =&gt; x.ProductAttributes.All(pa =&gt; andAttributes.Contains(pa.AttributeId)));
  </code></pre>
  
  <p>the above seems like it would work but doenst seem to.</p>
  
  <p>For the given example, <code>productAttributes</code> is a generic list that may contain 1 or more specific values.  </p>
  
  <p>In english, i want to select only the objects that contain both the super-quiet AND electric-start values in the <code>productAttributes</code> collection.</p>
  
  <p>This expression acts like an OR statement</p>
  
  <pre><code>var orx = gg.Where(x =&gt; x.ProductAttributes.Any(pa =&gt; orAttributes.Contains(pa.AttributeId)));
  </code></pre>