请看下面的代码:
Try
Dim Reader As New System.IO.StreamReader(PositionsFileName)
Do While Reader.Peek() <> -1
Dim Positions() As String = Reader.ReadLine().Split("|")
If (Positions(0) Is Nothing) Or (Positions(1) Is Nothing) Or (Positions(2) Is Nothing) Then
' something
End If
Loop
Catch ex As Exception
ex.Source = Nothing
End Try
我正在阅读一个文件并期待格式化某事|某事1|某事2。我正在尝试将它设置为“Nothing”到不存在的数组索引(文件格式已损坏),以便 If 语句顺利进行,但似乎我做错了。你能给我一些提示吗?