title: How do you implement the "IDictionaryEnumerator GetEnumerator()" method in IDictionary?
body: <p>I'm creating a dictionary data structure which implements the IDictionary interface. I'm stuck when it comes to implementing the <a href="https://msdn.microsoft.com/en-us/library/s9eb7a3t%28v=vs.110%29.aspx" rel="nofollow">GetEnumerator</a> method. I have an enumerator which gives KeyValuePair instances but from what I'm finding, I have to implement IDictionaryEnumerator.</p>
  
  <p>Is there a simple way to transform a KeyValuePair enumerator to an IDictionaryEnumerator? I know I can do the following hack:</p>
  
  <pre><code>IDictionaryEnumerator GetEnumerator()
  {
      return new Dictionary(this.KeyValueEnumerator()).GetEnumerator();
  }
  </code></pre>
  
  <p>But it seems very inefficient as it loads all the enumerator data.</p>