/// <summary> /// Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression. /// </summary> /// <param name="breakLabel">The <see cref="LoopCSharpStatement.BreakLabel" /> property of the result.</param> /// <param name="continueLabel">The <see cref="LoopCSharpStatement.ContinueLabel" /> property of the result.</param> /// <param name="variables">The <see cref="ForCSharpStatement.Variables" /> property of the result.</param> /// <param name="initializers">The <see cref="ForCSharpStatement.Initializers" /> property of the result.</param> /// <param name="test">The <see cref="ConditionalLoopCSharpStatement.Test" /> property of the result.</param> /// <param name="body">The <see cref="LoopCSharpStatement.Body" /> property of the result.</param> /// <param name="iterators">The <see cref="ForCSharpStatement.Iterators" /> property of the result.</param> /// <returns>This expression if no children changed, or an expression with the updated children.</returns> public ForCSharpStatement Update(LabelTarget breakLabel, LabelTarget continueLabel, IEnumerable <ParameterExpression> variables, IEnumerable <Expression> initializers, Expression test, IEnumerable <Expression> iterators, Expression body) { if (breakLabel == this.BreakLabel && continueLabel == this.ContinueLabel && variables == this.Variables && initializers == this.Initializers && test == this.Test && iterators == this.Iterators && body == this.Body) { return(this); } return(CSharpExpression.For(variables, initializers, test, iterators, body, breakLabel, continueLabel)); }
/// <summary> /// Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression. /// </summary> /// <param name="breakLabel">The <see cref="LoopCSharpStatement.BreakLabel" /> property of the result.</param> /// <param name="continueLabel">The <see cref="LoopCSharpStatement.ContinueLabel" /> property of the result.</param> /// <param name="variables">The <see cref="ForCSharpStatement.Variables" /> property of the result.</param> /// <param name="initializers">The <see cref="ForCSharpStatement.Initializers" /> property of the result.</param> /// <param name="test">The <see cref="ConditionalLoopCSharpStatement.Test" /> property of the result.</param> /// <param name="iterators">The <see cref="ForCSharpStatement.Iterators" /> property of the result.</param> /// <param name="body">The <see cref="LoopCSharpStatement.Body" /> property of the result.</param> /// <param name="locals">The <see cref="ConditionalLoopCSharpStatement.Locals" /> property of the result.</param> /// <returns>This expression if no children changed, or an expression with the updated children.</returns> public ForCSharpStatement Update(LabelTarget breakLabel, LabelTarget continueLabel, IEnumerable <ParameterExpression> variables, IEnumerable <Expression> initializers, Expression test, IEnumerable <Expression> iterators, Expression body, IEnumerable <ParameterExpression> locals) { if (breakLabel == BreakLabel && continueLabel == ContinueLabel && Helpers.SameElements(ref variables, Variables) && Helpers.SameElements(ref initializers, Initializers) && test == Test && Helpers.SameElements(ref iterators, Iterators) && body == Body && Helpers.SameElements(ref locals, Locals)) { return(this); } return(CSharpExpression.For(variables, initializers, test, iterators, body, breakLabel, continueLabel, locals)); }