2013-03-22 13 views
14

よく私はすべての詳細は"ではない"ラムダ式?

code,price,name 

今私は私がsplit

を使用して配列を取得することができます知っている

string codes="1,2,3" 

いくつかのコードを持つ文字列を持っていること

detailcollectionとしてコレクションを持っています

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