3 个维度的 Anarray
像这样初始化。
int[,,] arr = new int[2,3,3] {{{1,2,3},{4,5,6},{7,8,9}}, {{1,2,3},{4,5,6},{7,8,9}}};
你如何在 4 维array
或更多维中初始化它?
int[,,,] arr = new int[3,6,5,2] // how to initialize as above?
3 个维度的 Anarray
像这样初始化。
int[,,] arr = new int[2,3,3] {{{1,2,3},{4,5,6},{7,8,9}}, {{1,2,3},{4,5,6},{7,8,9}}};
你如何在 4 维array
或更多维中初始化它?
int[,,,] arr = new int[3,6,5,2] // how to initialize as above?
如果你想要一个和你一样的例子,它会是这样的:
int[, , ,] a = new int[2, 3, 3, 3] {
{
{
{ 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 }
},
{
{ 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 }
},
{
{ 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 }
}
},
{
{
{ 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 }
},
{
{ 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 }
},
{
{ 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 }
}
}
};