考虑这个例子:
public class People : IEnumerable
{
private Person[] _people;
public People(Person[] pArray)
{
_people = new Person[pArray.Length];
for (int i = 0; i < pArray.Length; i++)
{
_people[i] = pArray[i];
}
}
// Explicit Interface implementation
IEnumerator IEnumerable.GetEnumerator()
{
return (IEnumerator) GetEnumerator();
}
// What is this? Its neither overloading nor over riding.. What else is it?
public PeopleEnum GetEnumerator()
{
return new PeopleEnum(_people);
}
}
我经历过这种例子..但无法弄清楚它实际上是什么?请帮忙