title: How Can I Use IEnumerator.Reset()?
body: <p>How exactly is the right way to call <a href="http://msdn.microsoft.com/en-us/library/system.collections.ienumerator.reset.aspx"><code>IEnumerator.Reset</code></a>?</p>
  
  <p>The documentation says:</p>
  
  <blockquote>
    <p>The <code>Reset</code> method is provided for COM interoperability. It does not necessarily need to be implemented; instead, the implementer can simply throw a <code>NotSupportedException</code>.</p>
  </blockquote>
  
  <p>Okay, so does that mean I'm not supposed to ever call it?</p>
  
  <p>It's <em>so</em> tempting to use exceptions for flow control:</p>
  
  <pre><code>using (enumerator = GetSomeExpensiveEnumerator())
  {
      while (enumerator.MoveNext()) { ... }
  
      try { enumerator.Reset(); } //Try an inexpensive method
      catch (NotSupportedException)
      { enumerator = GetSomeExpensiveEnumerator(); } //Fine, get another one
  
      while (enumerator.MoveNext()) { ... }
  }
  </code></pre>
  
  <p>Is that how we're supposed to use it? Or are we not meant to use it from managed code at all?</p>