private Magazine[,] [] myMags;
I'm trying to have a 1d array (length 5) that contains 2d arrays of Magazine[14,14]. So that I could go (ie. each element in the 1d array references a 2d array with 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];
What is the correct syntax to initialise and assign an element in this manner?
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];
I believe this will work
private Magazine[,,] myVarName = new Magazine[4,14,14];
Reference http://msdn.microsoft.com/en-us/library/2yd9wwz4(v=VS.100).aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.