title: Using Get and Set to set specific array elements
body: <p>I'm having problem with a school assignment in C#. </p>
  
  <p>I include only a part of the code here, I hope that it suffices. </p>
  
  <p>I'm creating an array of the Bottle class with index 25. The Bottle class contains three properties. </p>
  
  <p>Now I need to get and set values in the array, but I don't manage to. </p>
  
  <p>See my example below. Where am I doing wrong? The program doesn't show any errors but the compilation does not succeed. If any more code would be necessary I'm happy to give it! </p>
  
  <pre><code>public class Sodacrate
  {
      private Bottle[] bottles;
      public Sodacrate() // Constructor for handling new sodas in the soda crate.
      {
          bottles = new Bottle[25];
  
          bottles[0].Brand = "Fanta";
          bottles[0].Price = 15;
          bottles[0].Kind = "Soda";
      }
  }
  
  
  public class Bottle
  {
      private string brand;
      private double price;
      private string kind;
  
      public string Brand
      {
          get { return brand; }
          set { brand = value; }
      }
  
      public double Price
      {
          get { return price; }
          set { price = value; }          
      }
  
      public string Kind
      {
          get { return kind; }
          set { kind = value; }
      }
  
  }
  </code></pre>