title: C# Generic Type as parameter
body: <p>I've got following interfaces and classes:</p>
  
  <pre><code>public abstract class A {}
  public abstract class B&lt;T&gt; : IType&lt;T&gt;
  {
      public T Value { get; set; }
  }
  
  public interface IType&lt;T&gt;
  {
      T Value { get; set; }
  }
  
  public class C : B&lt;String&gt;, IType&lt;String&gt; { }
  public class D : B&lt;Int32&gt;, IType&lt;Int32&gt; { }
  </code></pre>
  
  <p>How can I pass C or D as a method parameter, without using <code>A</code>? 
  So the parameter type has to be <code>IType&lt;T&gt;</code> or <code>B&lt;T&gt;</code>. </p>
  
  <p>Unfortunatly I'm completly new to generics, so any help would be gratefully appreciated. Thanks!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>What I'm trying to achieve is something like the following (won't compile) </p>
  
  <pre><code>public void SetB(B&lt;T&gt; Type)
  {
      //Do stuff...
  }
  </code></pre>
  
  <p>So that I can pass C or D to that method.</p>