Пример #1
0
        public static IAsyncResult RunAsync <T>(Func <IAsyncExecutor, IEnumerator <int> > action, T state, Action <T> complete)
        {
            AsyncExecutor executor = new AsyncExecutor();

            AsyncCallback callback = x =>
            {
                executor.EndExecute(x);
                complete(state);
            };

            return(executor.BeginExecute(action(executor), callback, state));
        }
Пример #2
0
        public static void Run(Func <IAsyncExecutor, IEnumerator <int> > action)
        {
            AsyncExecutor executor = new AsyncExecutor();

            executor.Execute(action(executor));
        }