public Enumerator(Action <Func <T, bool> > enumProc, IFiberFactory fiberFactory) { this.fiberFactory = fiberFactory; enumFiber = fiberFactory.CreateNew( () => { enumProc(FiberNext); state = -1; mainFiber.Switch(); } ); }
public bool MoveNext() { if (state == 0 || state == 1) { mainFiber = fiberFactory.CurrentFiber; try{ enumFiber.Switch(); }finally{ mainFiber = null; } if (state == 1) { return(true); } enumFiber.Dispose(); return(false); } return(false); }