If I use yield instead of manually creating an IEnumerator, is it possible to implement IEnumerator.Reset?
This code implements an attribute that can be set to reset the enumerator. Notes:
Code:
public IEnumerator GetEnumerator(){
do{
this.shouldReset=FALSE;
for (Entry e = this.ReadEntry(); e != null; e = this.ReadEntry()){
if(self.shouldReset)break;
else yield return e;
}
}
while(self.shouldReset)
}