ang*_*gel 20 c# lambda compact-framework
我有一个detailcollection集合,每个细节都有
code, price, name
Run Code Online (Sandbox Code Playgroud)
并带有一些代码的字符串
string codes = "1,2,3";
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用数组 string.Split()
string[] codesarray = codes.Split(',');
Run Code Online (Sandbox Code Playgroud)
但是我如何才能获得产品codes呢?
// the idea I have, but I would not like to have a loop
for (int i = 0; i < codesarray.Length; i++)
{
detailcollection.Where(x => x.ope_idsku == codesarray[i])
}
Run Code Online (Sandbox Code Playgroud)
我想要像:
detailcollection.Where(x => x.ope_idsku not in (codesarray))
Run Code Online (Sandbox Code Playgroud)
Zbi*_*iew 38
选定的详细信息收集项目,其中不包含以下内容codesarray:
detailcollection.Where (x=> !codesarray.Contains(x.ope_idsku))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
26119 次 |
| 最近记录: |