1

我的以下查询对我来说看起来不错,但我不确定为什么我会出错。

错误是“string.containts(string) 的最佳重载有一些无效参数”。我在这里想念什么?

谢谢

string[] strHiddenESXi = {"Internal","Support","Archived"};
            var tblvirtualservers = from d in db.tblVirtualServers.Include(t => t.ChangeLog).Include(t => t.ESXi)
                                    where (!d.ESXi.ESXiName.Contains(strHiddenESXi)) && d.ESXiID != 20
4

1 回答 1

0
string[] strHiddenESXi = {"Internal","Support","Archived"};
var tblvirtualservers = from d in db.tblVirtualServers.Include(t => t.ChangeLog)
 .Include(t => t.ESXi)
 where (!strHiddenESXi.Contains(d.ESXi.ESXiName)) && d.ESXiID != 20

您必须将 Contains 与作为数组的 strHiddenESXi 一起使用。

你能试一下吗?

string[] strHiddenESXi = {"Internal","Support","Archived"};
var tblvirtualservers = from d in db.tblVirtualServers.Include(t => t.ChangeLog)
 .Include(t => t.ESXi)
 where (!strHiddenESXi.Any( a=> d.ESXi.ESXiName.Contains(a) )) && d.ESXiID != 20
于 2013-10-16T11:04:23.933 回答