GetInvokerFor() static private method

static private GetInvokerFor ( MethodInfo method ) : MethodInvoker
method MethodInfo
return MethodInvoker
コード例 #1
0
        public override object Invoke(object obj, BindingFlags options, Binder binder, object[] parameters, CultureInfo culture)
        {
            MethodInfo method = TypeReferences.ToExecutionContext(this.method);

            if (binder != null)
            {
                try
                {
                    return(method.Invoke(obj, options, binder, parameters, culture));
                }
                catch (TargetInvocationException exception)
                {
                    throw exception.InnerException;
                }
            }
            MethodInvoker methodInvoker = this.methodInvoker;

            if ((methodInvoker == null) && ((this.methodInvoker = MethodInvoker.GetInvokerFor(method)) == null))
            {
                try
                {
                    return(method.Invoke(obj, options, binder, parameters, culture));
                }
                catch (TargetInvocationException exception2)
                {
                    throw exception2.InnerException;
                }
            }
            return(methodInvoker.Invoke(obj, parameters));
        }
コード例 #2
0
        public override Object Invoke(Object obj, BindingFlags options, Binder binder, Object[] parameters, CultureInfo culture)
        {
            MethodInfo method = TypeReferences.ToExecutionContext(this.method);

            if (binder != null)
            {
                try{
                    return(method.Invoke(obj, options, binder, parameters, culture));
                }catch (TargetInvocationException e) {
                    throw e.InnerException;
                }
            }
            MethodInvoker invoker = this.methodInvoker;

            if (invoker == null)
            {
                this.methodInvoker = invoker = MethodInvoker.GetInvokerFor(method);
                if (invoker == null) //because the method is not safe to call via a thunk
                {
                    try{
                        return(method.Invoke(obj, options, binder, parameters, culture));
                    }catch (TargetInvocationException e) {
                        throw e.InnerException;
                    }
                }
            }
            return(invoker.Invoke(obj, parameters));
        }
コード例 #3
0
        public override Object Invoke(Object obj, BindingFlags options, Binder binder, Object[] parameters, CultureInfo culture)
        {
            if (binder != null)
            {
                try{
                    return(this.method.Invoke(obj, options, binder, parameters, culture));
                }catch (TargetInvocationException e) {
                    throw e.InnerException;
                }
            }
            MethodInvoker invoker = this.methodInvoker;

            if (invoker == null)
            {
                this.methodInvoker = invoker = MethodInvoker.GetInvokerFor(this.method);
            }
            return(invoker.Invoke(obj, parameters));
        }