LINQ To SQL中IN的用法

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 (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      

posted @ 2008-12-11 13:22  Unity外包团队  阅读(592)  评论(0编辑  收藏  举报