I\'m trying to create a wrapper for a Dictionary
.
Dictionary
implements IEnumerable
You've already had several answers to your main question. I'll answer the question raised in your edit...
The List
class actually has three different GetEnumerator
methods: The public method that's called when the compile-time instance is typed as List
itself, and two explicit interface implementations to meet the IEnumerable
/IEnumerable
contracts. The enumerator objects returned by all three methods are all the same List
type behind-the-scenes.
// Public method
public List.Enumerator GetEnumerator() { /* ... */ }
// IEnumerable explicit interface implementation
IEnumerator IEnumerable.GetEnumerator() { /* ... */ }
// IEnumerable explicit interface implementation
IEnumerator IEnumerable.GetEnumerator() { /* ... */ }