2013-03-22 21 views
14

de ben şimdi benLambda İfade "değil" için? o</p> <p><code>detailcollection</code> hangi her detay</p> <pre><code>code,price,name </code></pre> <p>olduğu gibi

string codes="1,2,3" 

i split

kullanarak bir dizi alabilirsiniz biliyorum bazı kodlarla bir dize var bir koleksiyona sahip
string[] codesarray=codes.split(',') 

o zaman nasıl ben değil 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]) 
    } 

ürünler ben

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

cevap

28

kimlikleri codesarray olmayan Seçilmiş ayrıntıları toplama ürün olarak bir şey istiyorum alabilirsiniz:

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

Hızlı olduğunu, Teşekkürler. – angel