title: C# Printing a border around a 2D Array
body: <p>I have a multidimensional array that I'm using as a box, and I have code that generates a border around it, like this:</p>
  
  <pre><code>#######
  #     #
  #     #
  #     #
  #     #
  #######
  </code></pre>
  
  <p>However what I don't understand is that I can have either a 0 or a 1 in the "j == ProcArea.GetUpperBound(...)" part and it works successfully without any errors or unexpected output.</p>
  
  <pre><code>            int[,] ProcArea = new int[rows, columns];
              //Generate border
              for (int i = 0; i &lt; rows; i++)
              {
                  for (int j = 0; j &lt; columns; j++)
                  {
                      if (i == 0 || j == 0 || i == ProcArea.GetUpperBound(0) || j == ProcArea.GetUpperBound(1))
                      {
                          ProcArea[i, j] = 2;
  
                      }
                  }
              }
  </code></pre>
  
  <p>Why does this work, and what is the correct value I should be using?</p>
  
  <p>Thanks</p>