Create() public static method

public static Create ( MethodInfo info ) : CallInstruction
info System.Reflection.MethodInfo
return CallInstruction
Esempio n. 1
0
        public DynamicInstructionN(Type delegateType, CallSite site)
        {
            var methodInfo = delegateType.GetMethod("Invoke");
            var parameters = methodInfo.GetParameters();

            _target         = CallInstruction.Create(methodInfo, parameters);
            _site           = site;
            _argumentCount  = parameters.Length - 1;
            _targetDelegate = site.GetType().GetField("Target").GetValue(site);
        }
Esempio n. 2
0
        public DynamicInstructionN(Type delegateType, CallSite site)
        {
            var methodInfo = delegateType.GetMethod("Invoke");
            var parameters = methodInfo.GetParameters();

            // <Delegate>.Invoke is ok to target by a delegate in partial trust (SecurityException is not thrown):
            _targetInvocationInstruction = CallInstruction.Create(methodInfo, parameters);
            _site           = site;
            _argumentCount  = parameters.Length - 1;
            _targetDelegate = site.GetType().GetInheritedFields("Target").First().GetValue(site);
        }
Esempio n. 3
0
 public void EmitCall(MethodInfo method, ParameterInfo[] parameters)
 {
     Emit(CallInstruction.Create(method, parameters));
 }