title: Generic with multiple constraints
body: <p>I'm trying to call a method with a definition similar to the following (simplified to avoid confusion):</p>
  
  <pre><code>public static void Register&lt;T&gt;(T value) where T : BaseClass, IInterface
  </code></pre>
  
  <p>This works fine so long as I have a class instance that defines both of those values.  The problem occurs when I pass a `BaseClass' into a method and then try to use that instance in the above declaration.  For example:</p>
  
  <pre><code>public class MyClass
  {
      public MyClass(BaseClass value)
      {
          Register(value);
      }
  }
  </code></pre>
  
  <p>I can pass and instance of a class that implements both BaseClass and IInterface into the constructor, but when I try to use that value in the <code>Register</code> method I get a compilation error stating:</p>
  
  <blockquote>
    <p>The type 'BaseClass' cannot be used as type parameter 'T' in the generic type or method 'Register(T)'. There is no implicit reference conversion from 'BaseClass' to 'IInterface'.</p>
  </blockquote>
  
  <p>If I change the type in the constructor like so:</p>
  
  <pre><code>public class MyClass
  {
      public MyClass(IInterface value)
      {
          Register(value);
      }
  }
  </code></pre>
  
  <p>I get an error stating:</p>
  
  <blockquote>
    <p>The type 'IInterface' cannot be used as type parameter 'T' in the generic type or method 'Register(T)'. There is no implicit reference conversion from 'IInterface' to 'BaseClass'.</p>
  </blockquote>
  
  <p>This seems like a bit of a catch-22.  <strong>Is there a way that I can define the parameter to indicate that it must implement both BaseClass and IInterface?</strong></p>