有没有办法像这样转换一些代码:
If someString <> "02" And someString <> "03" And someString <> "06" And someString <> "07" Then
btnButton.Enabled = False
End If
有点像这样(一个变量有多个值)
If someString <> "02", "03", "06", "07" Then
btnButton.Enabled = False
End If
最佳答案
Contains
可以工作吗?
Dim testAgainst As String() = {"02","03","06","07"}
If Not testAgainst.Contains(someString) Then
btnButton.Enabled = False
End If
关于.net - 检查一个字符串是否不等于任何一个字符串列表,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16725039/