title: Creating a collection for a base type with methods that will work on all inherited objects?
body: <p>I'm currently starting a new project and I've run into a bit of a readblock.  I'm hoping someone can help me out and I'll do my best to describe the problem.</p>
  
  <p>I have a base abstract class called "EntityBase".  From this class there are around 100 or so inherited classes.  EntityBase has a number of methods such as Load() and Save() that are common to all my inherited classes.  It also has a couple of constructors that accept either an integer or an IDataReader which are used to load the object from the database.</p>
  
  <p>That's all working quite well.</p>
  
  <p>Enter my new base class, named EntityCollectionBase which extends List&lt;EntityBase&gt;.  I'm trying to write a Load function for it but I'm not sure how to proceed.  Hopefully this bit of code can better illustrate my goal:</p>
  
  <pre><code> public bool Load()
   {
       bool result = true;
  
       using (IDataReader reader = _dbManager.ExectureReaderSProc(this.LoadProcedure, new SqlParameter[] { new SqlParameter("@parentId", _parentID) }))
       {
           this.Add(new EntityBase(reader)); // WON'T WORK, EntityBase IS ABSTRACT
       }
  
       return result;
   }
  </code></pre>
  
  <p>As you can see, I need the Load function to work in a generic manner to handle anything extending EntityBase, but because EntityBase is abstract, I cannot instanciate it.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks,<br />
  Sonny</p>