Lambda表达式“不在”?
我有一个detailcollection
集合,每个细节都有
code, price, name
并带有一些代码的字符串
string codes = "1,2,3";
我知道我可以使用string.Split()
获取数组
string[] codesarray = codes.Split(',');
但是我怎样才能获得不在codes
产品?
// the idea I have, but I would not like to have a loop for (int i = 0; i x.ope_idsku == codesarray[i]) }
我想要像:
detailcollection.Where(x => x.ope_idsku not in (codesarray))
选定的详细信息收集项目,其中ID不在codesarray
:
detailcollection.Where (x=> !codesarray.Contains(x.ope_idsku))