Double array information gets lost VB.NET

Dear all,

I have a very basic question. Still, I can’t figure out, how to do it correctly.

So I have this double array Test1, where I put in a single array Test2. In the first part, the double array Test1 contains the numbers I want it to have. However, when accessing it again, all values turned into the last values Test2 had.
So I understand, saying Test1(i) = Test2 is somehow wrong. But how else can I “copy” the values into Test1?

Thanks a lot for any help

    Dim Test2(0) As Integer
    Dim Test1(50)() As Integer

    Dim i, n As Integer
    For i = 0 To 50
      If i > 0 And i < 50 Then
        Print(Test1(i - 1)(0) & " still ok")
      End If

      For n = 0 To 0
        Test2(n) = i
      Test1(i) = Test2
      Print(Test1(i)(0) & " ok so far")

    For i = 0 To 50
      Print(Test1(i)(0) & "   not ok anymore")

Move the declaration/creation of test2 inside the first for loop. Then you store 50 unique copies of the array in the two-dimensional array. Now you store 50 references to the same array.
It is the difference between value types, like int, and reference types like classes, but also arrays.