コード例 #1
0
        public int For(int loopVarIndex, int maxIterationsIndex, params int[] loopContentIndexes)
        {
            var loopVarExpr      = (ParameterExpression)Expressions[loopVarIndex];
            var maxItExpr        = Expressions[maxIterationsIndex];
            var initValueExpr    = Expression.Constant(0);
            var conditionExpr    = Expression.LessThan(loopVarExpr, maxItExpr);
            var incrementExpr    = Expression.PostIncrementAssign(loopVarExpr);
            var loopContentBlock = Expression.Block(loopContentIndexes.Select(i => Expressions[i]));

            var expr =
                LoopProvider.For(loopVarExpr, initValueExpr, conditionExpr, incrementExpr, loopContentBlock);

            return(RegisterExpression(expr));
        }
コード例 #2
0
        public int For(int loopVarIndex, int initValueIndex, int conditionIndex, int incrementIndex,
                       params int[] loopContentIndexes)
        {
            var loopVarExpr      = (ParameterExpression)Expressions[loopVarIndex];
            var initValueExpr    = Expressions[initValueIndex];
            var conditionExpr    = Expressions[conditionIndex];
            var incrementExpr    = Expressions[incrementIndex];
            var loopContentBlock = Expression.Block(loopContentIndexes.Select(i => Expressions[i]));

            var expr =
                LoopProvider.For(loopVarExpr, initValueExpr, conditionExpr, incrementExpr, loopContentBlock);

            return(RegisterExpression(expr));
        }