title: Linq to SQL: WHERE IN statement
body: <pre><code>CREATE TABLE [MyNames]
  (
      [ID] INT IDENTITY PRIMARY KEY,
      [Name] NVARCHAR(255) NULL
  )
  
  INSERT INTO [MyNames] VALUES ('John')
  INSERT INTO [MyNames] VALUES ('Jane')
  INSERT INTO [MyNames] VALUES ('Peter')
  INSERT INTO [MyNames] VALUES ('Montgomery')
  INSERT INTO [MyNames] VALUES ('Sarah')
  </code></pre>
  
  <p>Based on the above (hypothetical) SQL schema and data, I want to use Linq to SQL to get all results where the name is <strong>in</strong> values of an array.</p>
  
  <pre><code>string[] names = {"John", "Cassandra", "Sarah"};
  
  var results = (from n in db.Names
                 where n.Name **in names**
                 select n).ToList();
  </code></pre>
  
  <p>The results should include <code>John</code> and <code>Sarah</code>. With that information I am then able to add the entries that need to be added, in this case <code>Cassandra</code>.</p>
  
  <p>I don't want to load all the Names because the list can get exceptionally long.</p>