-2

我正在使用线程从文件中读取并处理内容。我有以下代码:

Dim line As String = Nothing
Dim result As String = Nothing
Dim solved As Boolean
While strReader.EndOfStream <> True
    SyncLock strReader
        line = strReader.ReadLine()
        result = "ERROR"
    End SyncLock
    solved = False
    While solved = False
        result = Process(line)
        If Not result.Contains("ERROR") Then
            solved = True
        End If
    End While
    //some code
End While

它给了我这个错误:If Not result.Contains("ERROR") Then

带标签的效果很好,但我读到它们不适合编码。

我怎样才能摆脱这个错误?我究竟做错了什么?

谢谢!

4

1 回答 1

1

错误几乎说明了一切

Process(line) 

正在返回一个空值。修复Process()以返回非空值。

或者你可以这样做

If not result is nothing then 
  solved = not result.Contains("ERROR")
End if
于 2012-04-24T22:58:08.597 回答