title: Why is OfType<> faster than Cast<>?
body: <p>In answer to the following question:
  <a href="https://stackoverflow.com/questions/11416191/how-to-convert-matchcollection-to-string-array/11416739#comment15078364_11416739">How to convert MatchCollection to string array</a></p>
  
  <p>Given The two Linq expressions:</p>
  
  <pre><code>var arr = Regex.Matches(strText, @"\b[A-Za-z-']+\b")
      .OfType&lt;Match&gt;() //OfType
      .Select(m =&gt; m.Groups[0].Value)
      .ToArray();
  </code></pre>
  
  <p>and</p>
  
  <pre><code>var arr = Regex.Matches(strText, @"\b[A-Za-z-']+\b")
      .Cast&lt;Match&gt;() //Cast
      .Select(m =&gt; m.Groups[0].Value)
      .ToArray();
  </code></pre>
  
  <p>OfType&lt;> was benchmarked by user <a href="https://stackoverflow.com/users/999042/alex">Alex</a> to be slightly faster (and confirmed by myself).</p>
  
  <p>This seems counterintuitive to me, as I'd have thought OfType&lt;> would have to do both an 'is' comparison, <em>and</em> a cast (T).</p>
  
  <p>Any enlightenment would be appreciated as to why this is the case :)</p>