How can an anonymous type object have convert to a string if it's not enumerable?
<p>Say I define a variable like this:</p>

<pre><code>var o = new { RBI = 108, Name = "Roberto Alamar" };
</code></pre>

<p>I can do something like:</p>

<pre><code>Console.WriteLine("{0}", o);
</code></pre>

<p>But if I try:</p>

<pre><code>foreach (var i in o) {
    Console.WriteLine("{0}", o[i]);
}
</code></pre>

<p>I get an error:</p>

<pre><code>foreach statement cannot operate on variables of type 'AnonymousType#1' because 'AnonymousType#1' does not contain a public definition for 'GetEnumerator'
</code></pre>

<p>So how does it work under the hood? I'd think that a method for turning an object into a string would have to loop through all the properties to accomplish the task. Is there some special method that allows this to happen, or am I misunderstanding how this works?</p>
