How to use LINQ To SQL IN

There are letters to the editor and asked how to use LINQ To SQL IN,

it reminds me I have been found to make no mention of this usage, ^ _ ^ |||


   There are letters to the editor and asked how to use LINQ To SQL IN,

 It reminds me I have been found to make no mention of this usage, ^ _ ^ |||

Usage is as follows:

C#
       var result = from s1 in context.Customers where (new string[]
                      { "UK", "Lisboa" }).Contains(s1.City) select s1;
 
VB.NET
    Dim lists = From s1 In context.Customers Where (New String() {"UK", "Lisboa"}).Contains(s1.City) Select s1
 
那NOT IN呢?
C#
  var result = from s1 in context.Customers where !(new string[] { "UK", "Lisboa" }).Contains(s1.City) select s1;
 
VB.NET
      Dim lists = From s1 In context.Customers Where Not (New String() {"UK", "Lisboa"}).Contains(s1.City) Select s1      

Original: Big Box  LINQ To SQL how to use the IN


Guess you like

Origin www.cnblogs.com/petewell/p/11489862.html