He complains that GetEnumerator () returns an IEnumerator<T> for the IEnumerable<T> interface. To satisfy, your type should return IEnumerator<T> (and explicit for IEnumerator ).
But in many cases, it is desirable for the class to return a more specific type than the interface indicates, but interfaces do not allow such covariant return types. To do this, you can do what List<T> has and has GetEnumerator() to return your specific enumerator, but you must also implement explicit implementations for IEnumerable.GetEnumerator() , which returns IEnumerator and for IEnumerable<T>.GetEnumerator() which returns IEnumerator<T> :
// This is your specific version, like List<T> does public Enumerator GetEnumerator() { return new Enumerator(this); } // This is the one with the return value IEnumerator<T> expects IEnumerator<T> IEnumerable<T>.GetEnumerator() { return new Enumerator(this); } // Plus, it also expects this as well to satisfy IEnumerable IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }
If you look at List<T> , you will see that it implements GetEnumerator() three times:
- Once explicitly for
IEnumerable<T> - Once explicitly for
Enumerable - Once with a very specific list
You can do the same in your class if you want (which you like, so you started), but if you do, you must explicitly implement IEnumerable<T>.GetEnumerator() and IEnumerable.GetEnumerator()
If you move on to the definition, you can see other definitions in the object browser by selecting the different interfaces that it satisfies (or by assigning the List<T> instance to the IEnumerable or IEnumerable<T> link and going to the definition):

source share