Beispiel #1
0
        /// <summary>
        /// 异步调用方法
        /// 自动从线程池获取一个空闲线程去执行操作
        /// </summary>
        /// <param name="func"></param>
        /// <param name="parameter1"></param>
        /// <param name="parameter2"></param>
        public static FuncAsync <T1, T2, TResult> Invoke <T1, T2, TResult>(Func <T1, T2, TResult> func, T1 parameter1, T2 parameter2)
        {
            FuncAsync <T1, T2, TResult> @operator = new FuncAsync <T1, T2, TResult>(func, parameter1, parameter2);

            @operator.Invoke();
            return(@operator);
        }
Beispiel #2
0
        /// <summary>
        /// 异步调用方法
        /// 自动从线程池获取一个空闲线程去去执行操作
        /// </summary>
        /// <param name="func"></param>
        public static FuncAsync <TResult> Invoke <TResult>(Func <TResult> func)
        {
            FuncAsync <TResult> @operator = new FuncAsync <TResult>(func);

            @operator.Invoke();
            return(@operator);
        }
Beispiel #3
0
        public static FuncAsync <T1, T2, T3, T4, T5, T6, T7, T8, TResult> Invoke <T1, T2, T3, T4, T5, T6, T7, T8, TResult>(Func <T1, T2, T3, T4, T5, T6, T7, T8, TResult> func, T1 parameter1,
                                                                                                                           T2 parameter2, T3 parameter3, T4 parameter4, T5 parameter5, T6 parameter6, T7 parameter7, T8 parameter8)
        {
            FuncAsync <T1, T2, T3, T4, T5, T6, T7, T8, TResult> @operator = new FuncAsync <T1, T2, T3, T4, T5, T6, T7, T8, TResult>(func, parameter1, parameter2, parameter3,
                                                                                                                                    parameter4, parameter5, parameter6, parameter7, parameter8);

            @operator.Invoke();
            return(@operator);
        }
Beispiel #4
0
        public static FuncAsync <TParameter, TResult> Invoke <TParameter, TResult>(Func <TParameter, TResult> func, TParameter parameter)
        {
            TParameter param = parameter;
            FuncAsync <TParameter, TResult> @operator = new FuncAsync <TParameter, TResult>(func, param);

            @operator.Invoke();

            return(@operator);
        }