title: When enumerating a MatchCollection, why does var result in Object type rather than Match type?
body: <p>I noticed something that seems odd in the following code:</p>
  
  <pre><code>MatchCollection mc = Regex.Matches(myString, myPattern);
  foreach(var match in mc)
      Console.WriteLine(match.Captures[0]); // &lt;-- this line is invalid, unless I replace 'var' above with 'Match'
  </code></pre>
  
  <p>The variable <code>match</code> is of type <code>Object</code> rather than <code>Match</code>. I am used to enumerating collections using <code>var</code> with no issues like this. Why is <code>MatchCollection</code> different?</p>