title: c# linq - get elements from array which do not exist in a different array
body: <p>I have two arrays idxListResponse &amp; _index both of which have the same structure.</p>
  
  <p>Each of these arrays contains a number of elements with different properties one of which is a child array called indexdata</p>
  
  <p>Each element of this array has a number of properties one of which is another array called datafield. This has a number of key value pair properties.</p>
  
  <p>So in essence I have a hierarchy of 3 separate arrays.</p>
  
  <p>I'm looking to get the first level of the hierarchy + all elements of the 2nd level where the 3rd level items don't match, i.e. exclude only those items from the 2nd level where the 3rd level items are a match.</p>
  
  <p>I've tried approaching this a number of different ways but so far I'm not getting anywhere, could anyone help.</p>
  
  <p>FYI - here's my latest attempt</p>
  
  <pre><code>var q = idxListResponse.Index.Where(a =&gt;
      a.IndexData.All(b =&gt;
          b.DataField.All(c =&gt;
              _index.Index.Where(z =&gt;
                  z.IndexData.All(y =&gt; y.DataField.Contains(c.name))
              )
          )
      )
  );
  </code></pre>