If I have a List(Of x) and a List(Of y) is it possible to iterate over both at the same time?
Something like
for each _x as X, _y as Y in List(of x
No, not in vb.net with the vb loop constructs.
You can however do it yourself with the enumerators:
Sub MyOwnIENumeration()
Dim a As List(Of String), b As List(Of String)
Dim EnmA As System.Collections.Generic.IEnumerator(Of String) = a.GetEnumerator
Dim EnmB As System.Collections.Generic.IEnumerator(Of String) = b.GetEnumerator
If EnmA.MoveNext() And EnmB.MoveNext() Then
Do
If EnmA.Current = EnmB.Current Then
Debug.Print("list matched on " & EnmA.Current)
If Not EnmA.MoveNext() Then Exit Do
If Not EnmB.MoveNext() Then Exit Do
ElseIf EnmA.Current < EnmB.Current Then
If Not EnmA.MoveNext() Then Exit Do
Else
If Not EnmB.MoveNext() Then Exit Do
End If
Loop
End If
EnmA.Dispose() : EnmB.Dispose()
End Sub