title: How to select existing objects in LINQ query
body: <p>I have a table Companies</p>
  
  <pre><code>CompanyId
  CountryId
  and so on...
  </code></pre>
  
  <p>And then have a list of objects with following structure (let's name this list dataset)</p>
  
  <pre><code>Id
  CountryId
  CurrencyId
  TotalCost
  and so on...
  </code></pre>
  
  <p>and what I'm trying to do is to get all companies which exists in above dataset,
  so I'm trying to write query like:</p>
  
  <pre><code>IEnumerable&lt;Company&gt; companies = db.Companies.Where(a=a.CompanyId == dataset.Select(a=&gt;a.CompanyId).ToList()
  </code></pre>
  
  <p>but it gives me an error,</p>
  
  <blockquote>
    <p>Operator '==' cannot be applied to operands of typ int and List</p>
  </blockquote>
  
  <p>How to get rid of this error?</p>