I implemented the IEnumerator interface in some classes to enable the use of the foreach statement. As you probalbly know, the interface asks for the implementation of
object IEnumerator.Curren
bool IEnumerator.MoveNext() an
void IEnumerator.Reset()
The help to IEnumerator.MoveNext describes that "after the end of the collection is passed, subsequent calls to MoverNect return false until reset is called"
When, however, I have two foreach() loops after another in one method, the Reset() interface is gets called. Thus the second loop never returns an element!!
Can anybody tell me why? Is this the 'normal' implementation
Thanx for any help
Han
in code
foreach(CEntry Entry in MyObject
// do stuf
...
.... // Other operations, NOT MODIFYING MyObject !!
...
foreach(CEntry Entry in MyObject) // MyObject NEVER returns an objec
// do stuf