title: Recover a "lost" type parameter
body: <p>Basically, my question is: Is there some way to "recover" a type parameter that was lost by upcast to a non-generic base type, e.g., <code>Object</code>. Here is an example of what I mean:</p>
  
  <p>Consider I have received an <code>Object</code> <code>l</code> from a library and I know that <code>l</code> is an <code>IList&lt;T&gt;</code>, but I do not know the <code>T</code> (but I do know that it is a reference type, no value type). However, the exact type of <code>T</code> is not important, because all I want to do is to pass <code>l</code> to a generic method:</p>
  
  <pre><code>void doSomethingWithList&lt;T&gt;(IList&lt;T&gt; l){ ... }
  </code></pre>
  
  <p>However, I cannot do that, since I do not know to which type to cast <code>l</code>, i.e., I would like to do the following:</p>
  
  <pre><code>doSomethingWithList((IList&lt;&gt;)l);
  </code></pre>
  
  <p>I want to tell the compiler that <code>l</code> is an <code>IList</code> and it should call the method and bind the unknown type parameter to its parameter <code>T</code>. But it doesn't work like this. Do I have any options? Can I somehow pass an object for which I "lost" the type parameter to a generic method?</p>