title: How to force a derived class to fill a list defined in the base class?
body: <p>This is C# related, but actually the question is quite generic.</p>
  
  <p>Let's say that I have a base class</p>
  
  <pre><code>abstract class Base {
      protected List&lt;string&gt; MyList = new List&lt;string&gt;();
      protected abstract void FillMyList();
  }
  
  class Derived : Base {
      protected void FillMyList() {
          MyList.Add("test");
          MyList.Add("test2");
      }
  }
  </code></pre>
  
  <p>This is ok, the derived class fills the MyList defined in the base class.</p>
  
  <p>However, besides the abstract method name (FillMyList) - that hints that you actually HAVE to fill MyList - there is no clue to what this method is supposed to mean.</p>
  
  <p>Is there a better way to enforce or (better) suggest strongly that you will have to fill MyList when you are inheriting from Base?
  Maybe having the FillMyList declared as:</p>
  
  <pre><code>protected abstract void FillMyList(List&lt;string&gt; listToFill);
  </code></pre>
  
  <p>What do you suggest?</p>