我有一个包含这 3 项的数组:
string[] departmentArray = {
"Warranty Service Representative",
"Warranty Service Administrative Manager",
"Warranty and Site Administrator"
};
我有这个字符串
var department = "Warranty Service Representative"
我有这个条件,应该测试字符串部门是否不在departmentArray
if (Array.Exists(departmentArray, element => element != department)){
}
显然该字符串在数组中,因此它应该返回 false,但这对于我的字符串返回 true。我究竟做错了什么?
这不是更简单吗?
string[] departmentArray = {
"Warranty Service Representative",
"Warranty Service Administrative Manager",
"Warranty and Site Administrator" };
String department = "Warranty Service Representative";
if (departmentArray.Contains(department) == false)
{
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)