C# Multidimensional Array Definition
Posted
by Blaenk
on Stack Overflow
See other posts from Stack Overflow
or by Blaenk
Published on 2010-05-08T01:38:57Z
Indexed on
2010/05/08
1:48 UTC
Read the original article
Hit count: 227
Can someone help me convert this to C#. I've already spent more time than I would have liked trying to do it myself and it's preventing me from actually getting any work done. I guess it seems like C# has a limitation regarding how one can define arrays. I think somewhere inside I have to keep doing new int[]
but I'm not sure exactly where.
You don't have to convert the whole thing, just enough so I can understand how to do it. I would really appreciate it. I would like to use integers instead of characters, by the way.
Thanks again
// Pieces definition
char mArray [7][4][5][5] =
{
// Square
{
{
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 1, 0},
{0, 0, 1, 1, 0},
{0, 0, 0, 0, 0}
},
{
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 1, 0},
{0, 0, 1, 1, 0},
{0, 0, 0, 0, 0}
},
{
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 1, 0},
{0, 0, 1, 1, 0},
{0, 0, 0, 0, 0}
},
{
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 1, 0},
{0, 0, 1, 1, 0},
{0, 0, 0, 0, 0}
}
},
// and so on and so forth, for 6 more
};
© Stack Overflow or respective owner