title: How can I use LINQ to compare table values to values of properties of a list of objects?
body: <p>Given these classes,</p>
  
  <pre><code>public class Foo
  {   
      ...  
  
      public IList&lt;Bar&gt; BarList{ get; set; }
  }
  
  public class Bar
  {
      ...
  
      public int Property{ get; set; }
  }
  </code></pre>
  
  <p>How can I juse LINQ to to create a query that filters for matches of the value of Property, when Property is a property of an object within a list? </p>
  
  <p>i.e., I want to return all records where OtherTable's Property column has a value that matches ANY of the values of Property that exist in Foo.BarList. Something like</p>
  
  <pre><code>var result = db.MainTable.Include(m =&gt; m.OtherTable.Where(o =&gt; o.Property == {{Foo.BarList.Property}}) ...rest of query
  </code></pre>
  
  <p>Thank you.</p>