Beispiel #1
0
        internal static InvocationOnDispatcher GetDynamicInvocationOnDispatcher(MethodInfo method)
        {
            var cancellationParameter = GetCancellationParameter(method);

            if (cancellationParameter == null)
            {
                return(_DynamicEnqueueFunction);
            }

            var helper = new ProcessWithCancellationHelper(cancellationParameter.Position);

            return(helper.DynamicProceedWithCancellation);
        }
Beispiel #2
0
        internal static InvocationOnDispatcher GetInvocationOnDispatcherForGenericTask(Type targetType, MethodInfo method)
        {
            var cancellationParameter = GetCancellationParameter(method);

            if (cancellationParameter == null)
            {
                var methodInfo = _Proceed.MakeGenericMethod(targetType);
                return((InvocationOnDispatcher)Delegate.CreateDelegate(typeof(InvocationOnDispatcher), methodInfo));
            }

            var helper = new ProcessWithCancellationHelper(cancellationParameter.Position);
            var methodInfoWithCancellation = _ProceedForCancellation.MakeGenericMethod(targetType);

            return((InvocationOnDispatcher)methodInfoWithCancellation.CreateDelegate(typeof(InvocationOnDispatcher), helper));
        }