Confused with implementing IDictionary Interface in C#

I have a class that’s using the IDictionary Interface, and I’ve implemented all of its interface methods, except for GetEnumerator(), which seems to be quite puzzling to me.

Apparently, from Google searching, I’ve found that there’s two methods by which I have to implement the GetEnumerator method.

The first method is:

public IDictionaryEnumerator GetEnumerator()

and the second is:

IEnumerator System.Collections.IEnumerable.GetEnumerator()

The MSDN documentation doesn’t seem to be that helpful on how to implement either one, and I’m not quite sure how to do so.

Currently, I continually get compiler errors along the lines of:
Error CS0738:
does not implement interface member
`System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,GameDataItem>>.
GetEnumerator()’

I was wondering if anyone ever faced this issue, and what was the solution to such an issue?

iirc, GetEnumerator is the function used when you do iterations, e.g. a foreach with your object:

foreach(Object obj in myCollectionClassObject)

It will usually be some kind of loop where you return each member (or only certain if you want to) of your collection (using the keyword yield).

I have found this site to be very useful and much clearer than Microsoft’s help, you may want to give it a try! (it only describes the GetEnumerator method here, not how to implement it, but it should still be interesting to understand it better)