I am learning about IEnumerator and IEnumerable [new to c# in general].
I am trying to learn from this code example :

```
 class colors : IEnumerable , IEnumerator
{
    private string[] cols;
    private int iCurrent;

    public colors()
    {
        cols = new string[] { "Red", "White", "Blue", "Yellow" };
        iCurrent = -1;

    }

    public IEnumerator GetEnumerator()
    {
        return (IEnumerator)this;
    }
}

```

there is more in the code but my question is about the last line.

Firstly I dont understand what will be returned and dont fully understand this line in the code. Would it be a colors IEnumerator type , would it be a string type . Where/on what ***this*** is pointing?

Secondly in CPP I remember I created iterators like , an example :

```
  std::map<object>::iterator it

```

,and then I would use it in a for[needed to add it.begin() , it.end()] loop . Now I understand that C# ,after I created this iterator/IEnumerator, has foreach loop that will spares me all this headace. But is there a way to create them easier/faster?