Represents a dynamic method call in C#, providing the binding semantics and the details about the operation. Instances of this class are generated by the C# compiler.
Inheritance: System.Dynamic.InvokeMemberBinder, ICSharpInvokeOrInvokeMemberBinder
コード例 #1
0
        /// <summary>
        /// DynamicOperatorRewriter in EE generates call to this method to dynamically invoke a method.
        /// </summary>
        /// <param name="methodArgs">Array that contains method arguments. The first element is an object on which method should be called.</param>
        /// <param name="argTypes">Type of each argument in methodArgs.</param>
        /// <param name="argFlags">Flags describing each argument.</param>
        /// <param name="methodName">Name of a method to invoke.</param>
        /// <param name="accessibilityContext">Type that determines context in which method should be called.</param>
        /// <param name="typeArguments">Generic type arguments if there are any.</param>
        /// <returns>Result of method invocation.</returns>
        public static object TryEvalMethodVarArgs(
            object[] methodArgs,
            Type[] argTypes,
            CSharpArgumentInfoFlags[] argFlags,
            string methodName,
            Type accessibilityContext,
            Type[] typeArguments)
        {
            Type[] delegateSignatureTypes = null;
            CSharpArgumentInfo[] argInfos = null;

            CreateDelegateSignatureAndArgumentInfos(
                methodArgs,
                argTypes,
                argFlags,
                out delegateSignatureTypes,
                out argInfos);

            CallSiteBinder binder;

            if (string.IsNullOrEmpty(methodName))
            {
                //null or empty indicates delegate invocation.
                binder = new CSharpInvokeBinder(
                    CSharpCallFlags.ResultDiscarded,
                    accessibilityContext,
                    argInfos);
            }
            else
            {
                binder = new CSharpInvokeMemberBinder(
                    CSharpCallFlags.ResultDiscarded,
                    methodName,
                    accessibilityContext,
                    typeArguments,
                    argInfos);
            }

            return(CreateDelegateAndInvoke(delegateSignatureTypes, binder, methodArgs));
        }
コード例 #2
0
			public Invocation (Compiler.Expression expr, Compiler.Arguments arguments, CSharpInvokeMemberBinder invokeBinder)
				: base (expr, arguments)
			{
				this.invokeBinder = invokeBinder;
			}
コード例 #3
0
 public Invocation(Compiler.Expression expr, Compiler.Arguments arguments, CSharpInvokeMemberBinder invokeBinder)
     : base(expr, arguments)
 {
     this.invokeBinder = invokeBinder;
 }