예제 #1
0
        private static ITaskManagerEntry CreateEntry <TResult>(Func <TResult> func, TaskScheduler scheduler = null, TaskCreationOptions options = default(TaskCreationOptions))
        {
            var entry = new FuncTaskManagerEntry <TResult>(func, scheduler, options);

            AddEntry(entry);
            return(entry);
        }
예제 #2
0
        private static ITaskManagerEntry CreateEntry <T1, T2, T3, T4, T5, T6, T7, T8, TResult>(Func <T1, T2, T3, T4, T5, T6, T7, T8, TResult> func, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7, T8 param8, TaskScheduler scheduler = null, TaskCreationOptions options = default(TaskCreationOptions))
        {
            var funcObj = new Func <object, TResult>((obj) =>
            {
                var tuple = obj as Tuple <T1, T2, T3, T4, T5, T6, T7, Tuple <T8> >;
                return(func(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6, tuple.Item7, tuple.Rest.Item1));
            });
            var entry = new FuncTaskManagerEntry <TResult>(funcObj, new Tuple <T1, T2, T3, T4, T5, T6, T7, Tuple <T8> >(param1, param2, param3, param4, param5, param6, param7, new Tuple <T8>(param8)), scheduler, options);

            AddEntry(entry);
            return(entry);
        }
예제 #3
0
        private static ITaskManagerEntry CreateEntry <T1, T2, T3, T4, TResult>(Func <T1, T2, T3, T4, TResult> func, T1 param1, T2 param2, T3 param3, T4 param4, TaskScheduler scheduler = null, TaskCreationOptions options = default(TaskCreationOptions))
        {
            var funcObj = new Func <object, TResult>((obj) =>
            {
                var tuple = obj as Tuple <T1, T2, T3, T4>;
                return(func.Invoke(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4));
            });
            var entry = new FuncTaskManagerEntry <TResult>(funcObj, new Tuple <T1, T2, T3, T4>(param1, param2, param3, param4), scheduler, options);

            AddEntry(entry);
            return(entry);
        }
예제 #4
0
        private static ITaskManagerEntry CreateEntry <T, TResult>(Func <T, TResult> func, T param, TaskScheduler scheduler = null, TaskCreationOptions options = default(TaskCreationOptions))
        {
            var entry = new FuncTaskManagerEntry <TResult>(
                new Func <object, TResult>((obj) =>
            {
                return(func((T)obj));
            }),
                param, scheduler, options);

            AddEntry(entry);
            return(entry);
        }
예제 #5
0
        private static ITaskManagerEntry CreateEntry <T1, T2, TResult>(Func <T1, T2, TResult> func, T1 param1, T2 param2, TaskScheduler scheduler = null, TaskCreationOptions options = default(TaskCreationOptions))
        {
            var entry = new FuncTaskManagerEntry <TResult>(
                new Func <object, TResult>((obj) =>
            {
                var tuple = obj as Tuple <T1, T2>;
                return(func(tuple.Item1, tuple.Item2));
            }),
                new Tuple <T1, T2>(param1, param2),
                scheduler, options);

            AddEntry(entry);
            return(entry);
        }