Exemplo n.º 1
0
        static IEnumerable <int> CoFunction2(int a, int b)
        {
            var args = Coroutine.Args(new { x = 0, y = 0 });

            Console.WriteLine("args = " + args);

            yield return(1 * args.x * a);

            Console.WriteLine("args = " + Coroutine.Args(ref args));

            Coroutine.WaitWhile(() => !timedOut);
            yield return(2 * args.x * a);

            Console.WriteLine("args = " + Coroutine.Args(ref args));

            yield return(3 * args.y * b);

            Console.WriteLine("args = " + Coroutine.Args(ref args));

            yield return(4 * args.y * b);

            Console.WriteLine("args = " + Coroutine.Args(ref args));
        }