Sub Button1_Click
Dim OldgBSize As Int = gB.Length
' Conserva i byte memorizzati fin qui
Dim Dummy(OldgBSize) As Byte
mByteConverter.ArrayCopy(gB, 0, Dummy, 0, OldgBSize)
' Simula l'arrivo dei dati
Dim x As Int = Rnd(1,11)
Dim Buffer(x) As Byte
Log("buffer:")
For i = 0 To x-1
Buffer(i) = Rnd(0,256)
Log(i & TAB & Buffer(i))
Next
Log("")
' ReDim senza Preserve, sigh
Dim gB(OldgBSize + Buffer.Length) As Byte
' Copia i vecchi byte
mByteConverter.ArrayCopy(Dummy, 0, gB, 0, OldgBSize)
' Copia i nuovi byte
mByteConverter.ArrayCopy(Buffer, 0, gB, OldgBSize, Buffer.Length)
Log("gB")
For i = 0 To gB.Length - 1
Log(i & TAB & gB(i))
Next
Log("")
End Sub