title: LINQ to SQL: Advanced queries against lists, arrays and lists of objects
body: <p><strong>Single and multiple lists</strong></p>
  
  <p>Consider the following lists:</p>
  
  <pre><code>List&lt;Int32&gt; appleIdentities = new List&lt;int&gt;(new[] { 1, 2, 3 });
  List&lt;Int32&gt; chocolateIdentities = new List&lt;int&gt;(new[] { 2, 3, 4 });
  List&lt;Int32&gt; icecreamIdentities = new List&lt;int&gt;(new[] { 11, 14, 15, 16 });
  </code></pre>
  
  <p>Using LINQ to SQL; is it possible to wite a statement which translates into:</p>
  
  <pre><code>SELECT
      DesertsID,
      DesertsName
  FROM
      Deserts
  WHERE
      Deserts.AppleIdentity IN (1, 2, 3) AND
      Deserts.ChocolateIdentity IN (2, 3, 4) AND
      Deserts.IcecreamIdentity IN (11, 14, 15m 16)
  </code></pre>
  
  <p>If yes; how would the code look if I wanted to query my database of deserts against just the <code>appleIdentities</code> list?
  <br />
  <br />
  <br />
  <br />
  <strong>Arrays</strong></p>
  
  <p>Consider the following arrays:</p>
  
  <pre><code>Int32[] appleIdentities = new[] {1, 2, 3, 4};
  String[] chocolateNames = new[] {"Light", "Dark"};
  </code></pre>
  
  <p>Using LINQ to SQL; is it possible to wite a statement which translates into:</p>
  
  <pre><code>SELECT
      DesertsID,
      DesertsName
  FROM
      Deserts
  WHERE
      Deserts.AppleIdentity IN (1, 2, 3) AND
      Deserts.ChocolateName IN ('Light', 'Dark')
  </code></pre>
  
  <p>If yes; how would the code look if I wanted to query my database of deserts against just the <code>appleIdentities</code> array?
  <br />
  <br />
  <br />
  <br />
  <strong>List of objects</strong></p>
  
  <p>Consider the following:</p>
  
  <pre><code>public class Identities
  {
      public Int32 appleIdentity { get; set; }
      public String chokolateName { get; set; }
  }
  
  List&lt;Identities&gt; identities = new List&lt;Identities&gt;(new[] {
      new Identities { appleIdentity = 1, chokolateName = "Light" },
      new Identities { appleIdentity = 2, chokolateName = "Dark" },
  });
  </code></pre>
  
  <p>Using LINQ to SQL; is it possible to wite a statement which translates into:</p>
  
  <pre><code>SELECT
      DesertsID,
      DesertsName
  FROM
      Deserts
  WHERE
      Deserts.AppleIdentity IN (1, 2) AND
      Deserts.ChocolateName IN ('Light', 'Dark')
  </code></pre>
  
  <p>If yes; how would the code look if I wanted to query my database of deserts against just the <code>appleIdentity</code>-property on my list of <code>Identities</code> objects?
  <br />
  <br />
  <br />
  This is branch off of <a href="https://stackoverflow.com/questions/729899/linq-to-sql-query-against-a-list-of-entities">LINQ to SQL query against a list of entities</a></p>