2013-03-22 75 views
14

以及我有一个集合,因为它Lambda Expression for“not in”?

detailcollection其中的每一个细节都

code,price,name 

现在我有一些代码

string codes="1,2,3" 

我知道我可以使用split

一个数组的字符串
string[] codesarray=codes.split(',') 

那么怎样才能得到产品不codes

/*it is the idea i have, but i would not like to have a loop*/ 
    for(int i=0; i< codesarray.count;i++) 
    { 
    detailcollection.Where (x=> x.ope_idsku ==codesarray[i]) 
    } 

我想的东西,因为它

detailcollection.Where (x=> x.ope_idsku not in (codesarray)) 

回答

28

选定的信息采集项目,其ID是不codesarray

detailcollection.Where (x=> !codesarray.Contains(x.ope_idsku)) 
+0

你快,谢谢。 – angel 2013-03-22 16:31:12