private Magazine[,] [] myMags;
我试图有一个1d数组(长度5),其中包含杂志的2d数组[14,14]。以便我能去。1d数组中的每个元素引用一个2d数组,尺寸为14x14 (=196 Magazines)):
myMags[0] = new Magazine[14,14];
myMags[1] = new Magazine[14,14];
myMags[2] = new Magazine[14,14];
myMags[3] = new Magazine[14,14];
myMags[4] = new Magazine[14,14];
以这种方式初始化和赋值元素的正确语法是什么?
Magazine[][,] myMags = new Magazine[5][,];
myMags[0] = new Magazine[14, 14];
myMags[1] = new Magazine[14, 14];
myMags[2] = new Magazine[14, 14];
myMags[3] = new Magazine[14, 14];
myMags[4] = new Magazine[14, 14];
我相信这会成功的
private Magazine[,,] myVarName = new Magazine[4,14,14];
引用http://msdn.microsoft.com/en-us/library/2yd9wwz4 (v = VS.100) . aspx