Exemplo n.º 1
0
 public Task FromAsync(Func <AsyncCallback, object, IAsyncResult> beginMethod, Action <IAsyncResult> endMethod,
                       object state, TaskCreationOptions creationOptions)
 {
     return(TaskFactory <object> .FromAsyncBeginEnd(beginMethod,
                                                    l => { endMethod(l); return null; },
                                                    state, creationOptions));
 }
Exemplo n.º 2
0
        public Task FromAsync <TArg1, TArg2, TArg3> (Func <TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Action <IAsyncResult> endMethod,
                                                     TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, TaskCreationOptions creationOptions)
        {
            if (endMethod == null)
            {
                throw new ArgumentNullException("endMethod");
            }

            return(TaskFactory <object> .FromAsyncBeginEnd(beginMethod,
                                                           l => { endMethod(l); return null; },
                                                           arg1, arg2, arg3, state, creationOptions));
        }
Exemplo n.º 3
0
 public Task <TResult> FromAsync <TArg1, TArg2, TArg3, TResult> (Func <TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Func <IAsyncResult, TResult> endMethod,
                                                                 TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, TaskCreationOptions creationOptions)
 {
     return(TaskFactory <TResult> .FromAsyncBeginEnd(beginMethod, endMethod, arg1, arg2, arg3, state, creationOptions));
 }