title: Generic Variance in C# 4.0
body: <p>Generic Variance in C# 4.0 has been implemented in such a way that it's possible to write the following without an exception (which is what would happen in C# 3.0):</p>
  
  <pre><code> List&lt;int&gt; intList = new List&lt;int&gt;();
   List&lt;object&gt; objectList = intList; 
  </code></pre>
  
  <p><strong><em>[Example non-functional: See Jon Skeet's answer]</em></strong></p>
  
  <p>I recently attended a conference where Jon Skeet gave an excellent overview of Generic Variance, but I'm not sure I'm completely getting it - I understand the significance of the <code>in</code> and <code>out</code> key words when it comes to contra and co-variance, but I'm curious to what happens behind the scenes.</p>
  
  <p><strong>What does the CLR see when this code is executed?</strong> Is it implicitly converting the <code>List&lt;int&gt;</code> to <code>List&lt;object&gt;</code> or is it simply built in that we can now convert between derived types to parent types?</p>
  
  <p><strong>Out of interest, why wasn't this introduced in previous versions and what's the main benefit - ie real world usage?</strong></p>
  
  <p>More info on this <a href="https://stackoverflow.com/questions/245607/how-is-generic-covariance-contra-variance-implemented-in-c-4-0">post</a> for Generic Variance (but question is extremely outdated, looking for real, up-to-date information)</p>