title: Cast IList<Object> to IList<CustomObject>?
body: <p>I created a generic function that retreives a JSON and parses it:</p>
  
  <pre><code>    public IList&lt;Object&gt; RetrieveView(string result)
      {
          JavaScriptSerializer ser = new JavaScriptSerializer();
  
          IList&lt;Object&gt; values = ser.Deserialize&lt; IList&lt;Object&gt; &gt;(result);
  
          return values;
      }
  </code></pre>
  
  <p>The problem that i have alot of Classes that uses this.
  for example when i try to use this:</p>
  
  <pre><code>IList&lt;Receipt&gt; receipts = (IList&lt;Receipt&gt;)RetrieveView(result);
  </code></pre>
  
  <p>I get <code>InvalidCastException</code> <code>Unable to cast object of type 'System.Collections.Generic.List[System.Object]' to type 'System.Collections.Generic.IList[Receipt]'.</code></p>
  
  <p>Anyway to keep my function Generic and be able to cast it to all of my classes/models?</p>