Beispiel #1
0
        internal ActionMethod(MethodInfo methodInfo)
            : base(methodInfo)
        {
            _invokeLooseExpression = new Lazy <Expression <Action <object, object[]> > >(() => ExpressionFactory.CreateNonGenericInstanceMethodActionExpression(methodInfo));
            _invokeLoose           = new Lazy <Action <object, object[]> >(() => _invokeLooseExpression.Value.Compile());

            _invokeExpression = new Lazy <Expression <Action <TDeclaringType> > >(() => ExpressionFactory.CreateInstanceMethodActionExpression <TDeclaringType>(methodInfo));
            _invoke           = new Lazy <Action <TDeclaringType> >(() => _invokeExpression.Value.Compile());
        }
Beispiel #2
0
        internal Constructor(ConstructorInfo constructorInfo)
            : base(constructorInfo)
        {
            if (constructorInfo == null)
            {
                throw new ArgumentNullException("constructorInfo");
            }

            _constructorInfo  = constructorInfo;
            _invokeExpression = new Lazy <Expression <Func <object[], object> > >(() => ExpressionFactory.CreateConstructorFuncExpression(constructorInfo));
            _invoke           = new Lazy <Func <object[], object> >(() => _invokeExpression.Value.Compile());
            _parameters       = new Lazy <ITypeCrawler[]>(() => constructorInfo.GetParameters().Select(p => TypeCrawler.Get(p.ParameterType)).ToArray());
        }