다음을 통해 공유


How to do a Join in VB.

Well, if you are using May CTP, then there is only one kind of Join operations that you can do in VB  -  cross-join.

The syntax for performing cross-join of two collections follows:

Dim

arr1 = New Integer() {1, 2, 3}
Dim arr2 = New String() {"Hi", "Bye"}

Dim q = From i In arr1, j In arr2 Select i, j

For Each element In q
Console.WriteLine(" i = " & element.i & " j = " & element.j)
Next

=====  Expected output:

 i = 1 j = Hi
 i = 1 j = Bye
 i = 2 j = Hi
 i = 2 j = Bye
 i = 3 j = Hi
 i = 3 j = Bye

.