title: Two-Dimensional Array Rectangle in C#
body: <p>I need to create a new rectangle using two dimensional arrays in C#. </p>
  
  <p>I created an image called brick_fw and imported it into the IDE for the game I'm creating. </p>
  
  <p>Here's the code I have (which is in it's own class named Brick): </p>
  
  <pre><code>brickLength = 60;
  brickHeight = 20;
  int[,] brickLocation = { { 0, 0 }, { 62, 0 }, { 123, 0 }, { 184, 0 }, { 245, 0 }, { 306, 0 }, { 367, 0 } };
  bool[] brickLive = { true, true, true, true, true, true, true };
  
  brickImage = Breakout.Properties.Resources.brick_fw;
  brickRec = new Rectangle(x, y, brickLength, brickHeight);
  </code></pre>
  
  <p>The problem I have here is;
  <code>brickRec</code> can only use the integer values of x and y and only accepts this way of representing a new rectangle (meaning if I remove the x and y from the brackets and replace it with <code>brickLocation</code> then the compiler will moan).</p>
  
  <p>As it stands, the compiler will only draw a single brick into the program because it's not taking into account the two dimensional array. 
  Is there a way to represent this <code>brickLocation</code> within the Rectangle function?</p>
  
  <p>EDIT:</p>
  
  <pre><code>public Brick()
  {
      brickLength = 60;
      brickHeight = 20;
      int[,] brickLocation = { { 0, 0 }, { 62, 0 }, { 123, 0 }, { 184, 0 }, { 245, 0 }, { 306, 0 }, { 367, 0 } };
      bool[] brickLive = { true, true, true, true, true, true, true };
  
      brickImage = Breakout.Properties.Resources.brick_fw;
  
      for (int i = 0; i &lt; brickLocation.GetLength(0); i++)
      {
          brickRec = new Rectangle(brickLocation[i, 0], brickLocation[i, 1], brickLength, brickHeight);
  
      }
  }
  
  
  public void drawBrick(Graphics paper)
  {
      paper.DrawImage(brickImage, brickRec);
  }
  </code></pre>