title: get a class without a lot of if statements
body: <p>I have a certain amount of classes which inherit from an abstract class:</p>
  
  <pre><code>abstract public class baseClass
  {
      //logics
  }
  
  public class child1 : baseClass
  {
  }
  
  public class child2 : baseClass
  {
  }
  </code></pre>
  
  <p>now I've got some management class which will have to create one of these classes depending on a enum which will have as value the same name so like this:</p>
  
  <pre><code>public enum ClassType
  {
      child1,
      child2
  }
  
  public class Manager
  {
      private List&lt;baseClass&gt; _workers;
  
      public void Initialize(ClassType type)
      {
          //what logics to put here? (resulting in correctChild)
          _workers.Add(correctChild);
      }
  }
  </code></pre>
  
  <p>I was thinking of typeof but don't know quite how to implement it. 
  Note: in this example it's 2 classes but in the real case it's an arbitrary amount of classes.</p>