title: Generic with multiple classes
body: <p>I'm trying to create this generic method to simplify things but I think I messed it up! Can you help with my problem?</p>
  
  <p>This compiles:</p>
  
  <pre><code>private string ConcatenateText&lt;T1, T2&gt;(MyEntity myEntity) 
      where T1 : Supplier, new()
      where T1 : Employee, new()
      where T2 : SupplierDepartment, new()
      where T2 : EmployeeDepartment, new()
  {
      T1 p = new T1();
      T2 r = new T2();
      //Code here for myEntity treatment
      return mystring;
  }
  </code></pre>
  
  <p>While this does not compile:</p>
  
  <pre><code>protected void mybutton1_Click(object sender, EventArgs e)
  {
     string mystring = ConcatenaText&lt;Supplier, SupplierDepartment&gt;(myEntity);
  }
  
  //This does not compile
  protected void mybutton2_Click(object sender, EventArgs e)
  {
     string mystring = ConcatenaText&lt;Employee, EmployeeDepartment&gt;(myEntity);
  }
  </code></pre>
  
  <p><strong>Message: The type Supplier cannot be used as type parameter T1 in the generic type or method ConcatenateText(MyEntity myEntity). There is no implicit reference conversion from Supplier to Employee</strong></p>
  
  <p>Can this be done? What am I doing wrong? Can it be improved?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>And MyEntity is just another class in order to process it inside this generic method! It's not related to the types T. It just an argument. But it's clear that I can't do that, using 2 types like that. I thought that I could assign one or another and the CLR independently of my initialization could react as I wanted. I gonna accept the answer who share a little bit more information about it.</p>