title: Create intance of any C# class by generic way
body: <p>I want to create an instance of any class using generics.
  Is that possible?</p>
  
  <p>I tried this but doesnt work:</p>
  
  <pre><code>public class blabla 
  {
      public void bla();
  }
  public class Foo&lt;T&gt;
  {
      Dictionary&lt;string, Func&lt;object&gt;&gt; factory;
  
      public Foo() =&gt; factory = new Dictionary&lt;string, Func&lt;object&gt;&gt;();
      public WrapMe(string key) =&gt; factory.Add(key, () =&gt; new T());
  }
  
  ...
  
  var foo = new Foo&lt;blabla&gt;();
  foo.Wrapme("myBlabla");
  
  var instance = foo.factory["myBlabla"];
  instance.Bla();
  </code></pre>