C# 中 使用string.contains出现如下问题:
未处理的“System.NullReferenceException”类型的异常出现在 courses.exe 中。其他信息: 未将对象引用设置到对象的实例。
代码如下:
字符串数组b[i]已赋值:"123"或""
if (str1.Contains(b[i])) { str1 = tempstr1; break; }程序显示(str1.Contains(b[i])) 出现问题
请问应该如何修改?
多谢!