我有一个奇怪的问题.当我使用数组时,IIf正在搞乱.显然它正在检查我的其他声明,即使它没有被激活.以下是一些演示此问题的代码:
'works
Dim test As String = "bleh"
If values.Length < 6 Then
test = "200"
Else
test = values(5)
End If
'throws indexoutofrange exception
Dim itemLimit As String = IIf(values.Length < 6, "200", values(5))
Run Code Online (Sandbox Code Playgroud)