title: Cast generic ChildFolder<SomeType> to ChildFolder<object>?
body: <p>I have a generic type which is basically a wrapper for another class (for serialization purposes), <code>ChildFolder&lt;SomeType&gt;</code>. </p>
  
  <pre><code>    [Serializable]
      public class ChildFolder&lt;T&gt;
      {
          public T value;
      }
  </code></pre>
  
  <p>I have a reference to a ChildFolder&lt;> which is currently type <code>object</code>. I need to be able to access that object's .value, no matter what T is - getting it as an <code>object</code> is perfect. I was hoping that generic types would follow the heritability rules of the parameter class, so that this would work:</p>
  
  <pre><code>object obj = new ChildFolder&lt;SomeClass&gt;(); // (this is equivalent to what's coming in to the function as a parameter)
  
  ChildFolder&lt;object&gt; chObj = (ChildFolder&lt;object&gt;)obj;
  // and now chObj.value is of type object
  </code></pre>
  
  <p>But this line gives me <code>InvalidCastException: Specified cast is not valid.</code></p>
  
  <p>How can I typecast to ChildFolder if I don't know what the <code>&lt;T&gt;</code> is? Alternately, how can I access .value without typecasting it?</p>