title: C#: Getter and setter expression for array property
body: <p>How can I write the getter and setter expression for array property <code>CoolerFanIsOn</code> in the class <code>CoolerSystem</code>? I showed the similar desired expression for non-array property <code>IsOn</code> of <code>Lamp</code> class.</p>
  
  <pre><code>class CoolerFan{
  
      bool isOn;
      public bool IsOn {
          get =&gt; isOn;
          set {
              isOn = value;
          }
      }
  }
  
  class CoolerSystem {
  
      private CoolerFan[] = new CoolerFan[5];
      private bool[] coolerFanIsOn = new Boolean[5];
  
      // invalid code from now
  
      public bool[] CoolerFanIsOn {
          get =&gt; coolerFanIsOn[number];
          set {
              coolerFanIsOn[number] = value;
          }
      }
  }
  </code></pre>