title: Memory allocation when using foreach loops in C#
body: <p>I know the basics on how foreach loops work in C# (<a href="https://stackoverflow.com/questions/398982/how-do-foreach-loops-work-in-c">How do foreach loops work in C#</a>)</p>
  
  <p>I am wondering whether using foreach allocates memory that may cause garbage collections? (for all built in System types).</p>
  
  <p>For example, using Reflector on the <code>System.Collections.Generic.List&lt;T&gt;</code> class, here's the implementation of GetEnumerator:</p>
  
  <pre><code>public Enumerator&lt;T&gt; GetEnumerator()
  {
      return new Enumerator&lt;T&gt;((List&lt;T&gt;) this);
  }
  </code></pre>
  
  <p>On every usage this allocates a new Enumerator (and more garbage).</p>
  
  <p>Do all types do this? If so, why? (can't a single Enumerator be reused?)</p>