Пример #1
0
        protected virtual Expression VisitForEachExpression(ForEachExpression expression)
        {
            var parameter = (ParameterExpression)this.Visit(expression.VariableExpression);
            var target = this.Visit(expression.Target);
            var body = this.Visit(expression.Body);

            if (parameter != expression.VariableExpression || target != expression.Target || body != expression.Body)
            {
                return new ForEachExpression(parameter, target, body);
            }

            return expression;
        }
Пример #2
0
        protected override Expression VisitForEachExpression(ForEachExpression expression)
        {
            this.Write("for (");
            this.Write(expression.VariableExpression.Type);
            this.Write(" ");
            this.Visit(expression.VariableExpression);
            this.Write(" in ");
            this.Visit(expression.Target);
            this.WriteLine(")");
            this.Visit(expression.Body);
            this.WriteLine();

            return expression;
        }