Viv*_*gon 6 c# arrays jagged-arrays multidimensional-array
我正在尝试在c#.net中构建一个应用程序
这里我有两个相同大小的单维数组.例如,我有矩阵M和N,如下面的结构:
M[0] M[1] M[2] M[3] M[4]
N[0]
N[1]
N[2]
N[3]
N[4]
Run Code Online (Sandbox Code Playgroud)
在这里,我将M [0] ......和N [0] ......的值分配给它们,以便得到如下矩阵:
5 6 4 8
4
8
7
2
Run Code Online (Sandbox Code Playgroud)
注意:我将此值设置为动态生成.我已经成功直到这一步.
但我喜欢以这种格式将值存储在2x2矩阵中的另一个数组(可能是锯齿状数组或其他数组)中:
A[0] A[1]
B[0] 5 4 (this is the values of M[0] and N[0])
B[1] 6 4 (this is the values of M[1] and N[0])
..............
B[4] 5 8 (this is the values of M[0] and N[1])
Run Code Online (Sandbox Code Playgroud)
当N [0]的第一行完成时,它必须继续下一行.我只需要一些如何在C#中实现它?