Exemple #1
0
        public static Task StartNew <T>(Action <T> method, T workItem, TaskCreationOptions creationOptions)
        {
            TaskHelperWorkItem workTask = new TaskHelperWorkItem
            {
                Delegate = method,
                Value    = workItem
            };

            return(Task.Factory.StartNew(ProxyWorker, workTask, creationOptions));
        }
Exemple #2
0
        private static void ProxyWorker(object obj)
        {
            TaskHelperWorkItem workItem = (TaskHelperWorkItem)obj;

            workItem.Delegate(workItem.Value);
        }