Exemple #1
0
        public Pair <Delegate, object[]> Compile(LambdaExpression lambda)
        {
            var constantExtractor = new ConstantExtractor(lambda);
            var tree      = constantExtractor.Process().ToExpressionTree();
            var constants = constantExtractor.GetConstants();
            var compiled  = cache.GetValue(tree, _tree => ((LambdaExpression)_tree.ToExpression()).Compile());

//      var compiled = ((LambdaExpression) tree.ToExpression()).Compile();
            return(new Pair <Delegate, object[]>(compiled, constants));
        }
Exemple #2
0
        public Pair <Delegate, object[]> Compile(LambdaExpression lambda)
        {
            var constantExtractor = new ConstantExtractor(lambda);
            var expressionTree    = constantExtractor.Process().ToExpressionTree();
            var constants         = constantExtractor.GetConstants();

            var compiled = cache.GetOrAdd(expressionTree, expressionTreeCompiler);

            return(new Pair <Delegate, object[]>(compiled, constants));
        }