我有两个字符串,我必须通过linq迭代?
我的状态为列,其行值为
Status
--------
Int
String
Boolean
Char
Float
LINQ
var result = from desc in result
where desc.Status == "string" && desc .Status == "Int"
select desc ;
如何实现这一点..我试过但它返回空。如果我尝试单一检查它是否正常工作。
答案 0 :(得分:5)
您需要使用||
运算符
where desc.Status == "string" || desc .Status == "Int"
答案 1 :(得分:1)
var result = from desc in result
where new[] {"Int","String","Boolean","Char","Float"}.Contains(desc.Status)
select desc ;