Below is an implementation of the GetEnumerator method:
Here is another way I have seen the GetEnumerator method being implemented:
My question is, that can the first implementation be written as the second implementation?
C#:
IEnumerator IEnumerable.GetEnumerator()
{
return (IEnumerator) GetEnumerator();
}
public PeopleEnum GetEnumerator()
{
return new PeopleEnum(_people);
}
Here is another way I have seen the GetEnumerator method being implemented:
C#:
public IEnumerator GetEnumerator()
{
return new ListEnumerator();
}
private class ListEnumerator : IEnumerator
{
}
My question is, that can the first implementation be written as the second implementation?