title: How to instantiate a type dynamically using reflection?
body: <p>I need to instatiate a C# type dynamically, using reflection. Here is my scenario: I am writing a base class, which will need to instantiate a certain object as a part of its initialization. The base class won't know what type of object it is supposed to instantiate, but the derived class will. So, I want to have the derived class pass the type to the base class in a base() call. The code looks something like this:</p>
  
  <pre><code>public abstract class MyBaseClass
  {
      protected MyBaseClass(Type myType)
      {
           // Instantiate object of type passed in 
           /* This is the part I'm trying to figure out */
      }
  }
  
  public class MyDerivedClass : MyBaseClass
  {
      public MyDerivedClass() : base(typeof(Whatever))
      {
      }
  }
  </code></pre>
  
  <p>In other words, the base class is delegating to its derived type the choice of the object type to be instantiated.</p>
  
  <p>Can someone please assist?</p>