title: C# Return generic type without type parameter at runtime
body: <p>Is it possible to return an object of type</p>
  
  <pre><code> IModel&lt; T &gt;
  </code></pre>
  
  <p>without knowing the type parameter? </p>
  
  <p>the objects are stored in a dictionary, with Type as the key and an object with <code>IModel</code>  (base interface to <code>IModel&lt;T&gt;</code>) implemented as a value.
  The interface <code>IModel&lt;T&gt;</code> inherits from <code>IModel</code>, but to do the full action I need an object of <code>IModel&lt;T&gt;</code>. <code>T</code> needs to have the interface <code>IFactoryItem</code>.</p>
  
  <p>but first the code:</p>
  
  <pre><code>    public IModel&lt;T&gt; GetModel&lt;T&gt;() where T : IFactoryItem
      {
           Type tmpType  = typeof(T);
           if (!_allModelsByType.ContainsKey(tmpType))
                  return null;
  
           return (IModel&lt;T&gt;)_allModelsByType[tmpType];
      }
  </code></pre>
  
  <p>i thought of a solution like</p>
  
  <p>public IModel GetModel(Type t) and a wrapper to cast it to the right type.</p>
  
  <p>I hope that i am not totally wrong.
  this is my first question.</p>