title: LINQ in C#. Check if one list contains elements from another one
body: <p>I have two lists (for example):</p>
  
  <pre><code>var NewIDs = new List&lt;string&gt;();
  NewIDs.AddRange(...some values...);
  
  var OldIDs = new List&lt;some type&gt;()
  OldIDs.AddRange(...some values...);
  </code></pre>
  
  <p>I need to return the OldIDs list, which contains only values from the first one. I do it this way:</p>
  
  <pre><code>var newList = OldIDs.Where(p =&gt; p.Id.All(x =&gt; NewIDs.Contains(x.ToString()))).ToList();
  </code></pre>
  
  <p>But it returns <code>count=0;</code></p>
  
  <p><b>EDIT 1:</b> NewIDs it's only List of strings, but OldIDs it's some structure, which have an Id propery</p>
  
  <p><b>EDIT 2:</b> It works this way:</p>
  
  <pre><code>var newList = new List&lt;MyType&gt;();
   foreach (var res in NewIDs)
     {
       newList.AddRange(OldIDs.Where(a =&gt; a.Id == res));
     }
  </code></pre>
  
  <p>I need to rewrite it without <code>foreach</code>, only using <code>LINQ</code></p>