Much appreciated. Thanks.
The code below declare a to be an array of size 3 in VB .NET:
Dim a() As Integer = {1, 2, 3}
The size need not be specified because the initialization determines the size. The code below declares b to be an array of size 3 in VB .NET, with no initial values:
Dim b(3) As Integer
The following two lines of code will display the values of b to be the same as a:
b = a
MessageBox.Show(b(0).ToString + " " + b(1).ToString + " " + b(2).ToString)
That is, b was initialized to the same value as a.
In the code above, a(1) is changed after b was set to the array a. You’ll find that b is changed too. Why? How does this differ from integers such as:
Dim x As Integer = 1
Dim y As Integer
y = x
x = 2
MessageBox.Show(y.ToString())
The code below declare a to be an array of size 3 in VB .NET:
Dim a() As Integer = {1, 2, 3}
The size need not be specified because the initialization determines the size. The code below declares b to be an array of size 3 in VB .NET, with no initial values:
Dim b(3) As Integer
The following two lines of code will display the values of b to be the same as a:
b = a
MessageBox.Show(b(0).ToString + " " + b(1).ToString + " " + b(2).ToString)
That is, b was initialized to the same value as a.
In the code above, a(1) is changed after b was set to the array a. You’ll find that b is changed too. Why? How does this differ from integers such as:
Dim x As Integer = 1
Dim y As Integer
y = x
x = 2
MessageBox.Show(y.ToString())