I have a multidimensional array
byte[,] matrix;
and i want copy in a 3 dimension array
byte[,,] 3dplan;
in this way
3dplan[,,0]=matrix
What is the fastest way to accomplish this task in c#?
Multidimensional Arrays in C / C++ A multi-dimensional array can be termed as an array of arrays that stores homogeneous data in tabular form. Data in multidimensional arrays are stored in row-major order.
You need to manually copy the elements in a nested loop; there is no faster way.
If you switch to a jagged array (byte[,][]
or byte[][][]
), you can insert the smaller array as-is into a slot in the larger array (although they will both refer to the same array instance and will pick up changes)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With