title: Cast Generic with derived type to generic with parent type
body: <p>I have a base class:</p>
  
  <pre><code>public abstract class InputParserBase&lt;TInputData&gt; : ServerComponentBase
          where TInputData : SolverDataBase
      {
          public abstract TInputData Parse(ClientInputData task);               
      }
  </code></pre>
  
  <p>and a child:</p>
  
  <pre><code>public class BinomTaskParser : InputParserBase&lt;BinomTaskData&gt;
      {
  
          public override BinomTaskData Parse(ClientInputData inputData)
          {//Some stuff
          }
      }
  </code></pre>
  
  <p>BinomTaskData is inherited from SolverDataBase</p>
  
  <p>My second class is in another assembley and i load it in runtime. And the thing is that i can have different childs with another types, derived from SolverDataBase. I want to load them and store like this:</p>
  
  <pre><code>var result = new List&lt;InputParserBase&lt;SolverDataBase&gt;&gt;();
  var parser = (InputParserBase&lt;SolverDataBase&gt;)AssembleyHelper.CreateInstance(typePair, null);
  result.Add(parser);
  </code></pre>
  
  <p>But get a cast exception. What am i doing wrong and how can i implement this?</p>