Exemplo n.º 1
0
 public Enumerator(Action <Func <T, bool> > enumProc, IFiberFactory fiberFactory)
 {
     this.fiberFactory = fiberFactory;
     enumFiber         = fiberFactory.CreateNew(
         () => {
         enumProc(FiberNext);
         state = -1;
         mainFiber.Switch();
     }
         );
 }
Exemplo n.º 2
0
            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);
            }