16,553
社区成员
发帖
与我相关
我的任务
分享
'筛选符合条件
For Each s As String In arr 'for1
If String.IsNullOrEmpty(s) Then Continue For
Dim nextFiller As Boolean = False
For Each b As fhBuilding In buildings 'for2
If nextFiller Then
nextFiller = False
Exit For
End If
For Each r As fhRoom In b.Rooms 'for3
If String.Equals(s, r.FullName, StringComparison.OrdinalIgnoreCase) Then
_VisRooms.Add(r)
nextFiller = True
Exit For '为什么exit for 不是离开for3 而是离开for2,直接跳到for1呢?
End If
Next
Next
Next
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim a1() As Integer = New Integer() {1, 2, 3, 4, 5}
Dim a2() As Integer = New Integer() {11, 12, 13, 14, 15}
Dim a3() As Integer = New Integer() {21, 22, 23, 24, 25}
Dim a4() As Integer = New Integer() {31, 32, 33, 34, 35}
Dim a5() As Integer = New Integer() {41, 42, 43, 44, 45}
For Each i1 As Integer In a1
For Each i2 As Integer In a2
For Each i3 As Integer In a3
For Each i4 As Integer In a4
For Each i5 As Integer In a5
Console.WriteLine(i5)
If i5 = 42 Then
Exit For
End If
Next
Next
Next
Next
Next
End Sub