Пример #1
0
        public static InvocationExpression Call(Expression instance, System.Reflection.MethodBase method, params Expression[] arguments)
        {
            NodeList <Expression> args = new NodeList <Expression>(arguments);
            InvocationExpression  exp  = new InvocationExpression(instance, args)
            {
                Method      = method,
                Conversions = new Runtime.ArgumentConversions(args.Count)
            };

            if (!method.MatchesArgumentTypes(args.Map(ex => ex.Type), exp.Conversions))
            {
                throw new InvalidOperationException("argument miss match");
            }
            return(exp);
        }