Why is the compiler-generated enumerator for "yield" not a struct? : <p>The <a href="http://csharpindepth.com/Articles/Chapter6/IteratorBlockImplementation.aspx">compiler-generated implementation</a> of <code>IEnumerator</code> / <code>IEnumerable</code> for <code>yield</code> methods and getters seems to be a class, and is therefore allocated on the heap. However, other .NET types such as <code>List&lt;T&gt;</code> specifically return <code>struct</code> enumerators to avoid useless memory allocation. From a quick overview of the <em>C# In Depth</em> post, I see no reason why that couldn't also be the case here. </p>

<p>Am I missing something?</p>
