title: C# Equivalent of Java's GenericType<?>
body: <p>I'm working with some generics in C#. I have an abstract generic class:</p>
  
  <pre><code>public abstract class BaseClass&lt;T&gt; where T : Foo { }
  </code></pre>
  
  <p>and the type parameter is specified when other classes inherit from the base class.</p>
  
  <p>I'm also trying to write some code for another abstract class that needs to store one of these base classes, but it won't know the parameter of the base class (and it doesn't need to know). In Java I could simple write:</p>
  
  <pre><code>protected BaseClass&lt;?&gt; myBaseClass;
  </code></pre>
  
  <p>But in C# it insists I give it a type parameter. If I declare it as:</p>
  
  <pre><code>protected BaseClass&lt;Foo&gt; myBaseClass;
  </code></pre>
  
  <p>I cannot assign any parametrized values of <code>BaseClass</code> to it.</p>
  
  <p>Is there a work around to achieve the effect of <code>BaseClass&lt;?&gt;</code> in C#? Obviously there are ways to restructure my code to avoid the need, such as parameterizing all of the classes that use <code>BaseClass</code> as well, but this would be less than ideal. Any help would be appreciated!</p>