Hi @jacky Perpète ,
For value types, you can use Buffer.BlockCopy() method to copy arrays, but for reference types, you need to assign multidimensional array manually.
An example of two-dimensional array.
Dim oneDimensionalArray() As ...
Dim index() As Integer = {2, 3}
Dim multiDimensionalArray As Array
Dim arrType As Type = oneDimensionalArray.GetType().GetElementType()
multiDimensionalArray = Array.CreateInstance(arrType, index)
Dim rowIndex, colIndex As Integer
For i As Integer = 0 To oneDimensionalArray.Length - 1
rowIndex = Math.Floor(i / index(1))
colIndex = i Mod index(1)
multiDimensionalArray(rowIndex, colIndex) = oneDimensionalArray(i)
Next
Hope it could be helpful.
Best Regards,
Xingyu Zhao
*
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.