title: C# Inherited Indexer: Another Way
body: <p>I have an abstract parent class that encapsulates access to an array of MyObjects:</p>
  
  <pre><code>public abstract class MyObjectIterator
  {
      public MyObjectIterator(MyObject[] MyObjects) { //constructor }
  
      public Vector2 [] Coords { //A Get Function }
  
      public Model[] Params { //A Get Function }
  
      //THIS ISN'T SAFE! CAN STILL CHANGE MEMBERS OF THE SET
      public MyObject[] MyObjects{ get; protected set; }
  }
  </code></pre>
  
  <p>A child class of this already implements a single index indexer for another purpose, so I cannot use it to return a MyObject.<br>
  However, as it is unsafe/bad practise to return the array, as this means the elements within can be modified, I am looking for a way that I can provide a tidy interface to accessing a single element, e.g.</p>
  
  <pre><code>MyObject = Child.MyObjects[i];
  </code></pre>
  
  <p>but without providing <code>set</code> access to any element of MyObjects.</p>
  
  <p>A related question I have is: If I have an indexer on a parent class, can this be used when you have an object of a child class?</p>
  
  <p><strong>Edit:</strong><br>
  I have decided to go with the method<br>
  <code>public MyObject MyObject(int index) { return MyObjects[index]; }</code>
  As it most accomplishes what I was wanting.</p>