我想要实现的是比较索引值。 arr1val1和arr2val1,然后是arr1val2和arr2val2,然后依此类推,只要它们具有相同数量的索引。最后是一个消息框,它将提示是否在任何比较的索引中检测到不匹配,而不管有多少不匹配。到目前为止,我有这段代码。
Dim str()() As String = _
New String()() {New String() {"arr1val1", "arr1val2"}, New String() {"arr2val1", "arr2val2"}}
For Each arstr As String() In str
For Each strElement As String In arstr
Next
Next
答案 0 :(得分:0)
根据您的评论:
Dim mismatchFound = False
For i = 0 To str(0).GetUpperBound(0)
If str(0)(i) <> str(1)(i) Then
mismatchFound = True
Exit For
End If
Next
简洁的方式,即使用LINQ:
Dim mismatchFound = Enumerable.Range(0, str(0).Length).
Any(Function(i) str(0)(i) <> str(1)(i))