title: C# assigning a class array but value is treated as 0
body: <p>i'm currently stuck on a project. I have to instantiate a class x amount of times. The value of x can be different every time you run the program. Here is my code for clarification.</p>
  
  <pre><code> public partial class Form1 : Form
  {
      private static int Rooms;              
      private Room[] room = new Room[Rooms]; 
  
      public Form1()
      {
          InitializeComponent();
          Start();
      }
  
      private void Start()
      {
          string[] lines = File.ReadAllLines(@"C:Path\Test.txt");
          Rooms = lines.Length;
          for (int i = 0; i &lt; room.Length; i++)
          {
              if (i == 13)
              {
                  continue;
              }
              else
              {
                  this.room[i] = new Room(i);
              }
              listBox1.Items.Add(this.room[i].RoomNumber.ToString());
          }
      }
  }
  </code></pre>
  
  <p>While debugging, hovering over <code>Rooms</code> at <code>Private static int Rooms;</code> displays the correct value; Hovering over <code>Rooms</code> at <code>private Room[] room = new Room[Rooms];</code> also displays the correct value, but treats it as if its 0. It doesnt add the room numbers to the listbox. If i use <code>Rooms + 1</code>, it just adds 1 roomnumber. Though if i replace <code>Rooms</code> with the correct x value, it does work. </p>
  
  <p>Does anyone here know what happens and how to fix this?</p>