title: dynamic multidimensional array c#
body: <p>I am not sure whether or not this has been answered before, but this question is really specific. I am attempting to code a dungeon generator in c#, and I want the size of the array to be dynamic, and it to display in the console as a grid, per the size inputted. I got the array to be dynamic, and it can display every index in a grid form, but I can't figure out how to make the amount of indexes in a row dynamic. Here's what I have so far:</p>
  
  <pre><code>        Random rand = new Random();
          int num;
          num = Convert.ToInt32(Console.ReadLine());
          int x = num;
          int y = num;
          int i = x - 1;
          int j = y - 1;
          int[,] dungeon = new int[x,y];
  
          for(int z = 0; z &lt;= i; z++)
          {
              int a = 0;
              for( a = 0; a &lt;= j; a++)
                {
                    dungeon[a,z] = rand.Next(0,2);
                }
  
              }
              for (int h = 0; h &lt;= i; h++) 
              {
                  if (h == 0)
                  {
                      Console.WriteLine("#-#-#-#-#");
                  }
              Console.WriteLine("|" + dungeon[h,0] + "|" + dungeon[h,1] + "|" + dungeon[h,2] + "|" + dungeon[h,3] + "|");
              Console.WriteLine("#-#-#-#-#");
  </code></pre>
  
  <p>Excuse the messiness. It isn't quite finished yet.</p>