2013-03-22 5 views
14

auch ich habe eine Sammlung, wie esLambda Ausdruck für "nicht in"?

detailcollection die jedes Detail

code,price,name 

jetzt habe ich mit einigen Codes eine Zeichenfolge haben

string codes="1,2,3" 

ich weiß, ich ein Array erhalten können mit split

string[] codesarray=codes.split(',') 

wie kann ich dann Produkte erhalten nicht in 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]) 
    } 

ich etwas, wie es

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

Antwort

28

Ausgewählte Details Sammlung Gegenstände, die IDs sind nicht in codesarray möchte:

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

Sie waren schnell, Vielen Dank. – angel