예제 #1
0
        public GenericInvoker(Expression <T> expression)
        {
            this.expression = expression;
            this.numParams  = GenericParametersVisitor.GenericParameters(expression);

            ParameterExpression tp = Expression.Parameter(typeof(Type[]));
        }
예제 #2
0
        public static int GenericParameters(LambdaExpression expression)
        {
            var gpv = new GenericParametersVisitor();

            gpv.Visit(expression);

            if (gpv.parameters == null)
            {
                throw new InvalidOperationException("No generic method or constructor found on expression:\r\n{0}".FormatWith(expression.ToString()));
            }

            return(gpv.parameters.Value);
        }