/// <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="variable">The <see cref="Variable" /> property of the result.</param> /// <param name="collection">The <see cref="Collection" /> property of the result.</param> /// <param name="conversion">The <see cref="Conversion"/> property of the result.</param> /// <param name="body">The <see cref="LoopCSharpStatement.Body" /> property of the result.</param> /// <returns>This expression if no children changed, or an expression with the updated children.</returns> public ForEachCSharpStatement Update(LabelTarget breakLabel, LabelTarget continueLabel, ParameterExpression variable, Expression collection, LambdaExpression conversion, Expression body) { if (breakLabel == this.BreakLabel && continueLabel == this.ContinueLabel && variable == this.Variable && collection == this.Collection && conversion == this.Conversion && body == this.Body) { return(this); } return(CSharpExpression.ForEach(variable, collection, body, breakLabel, continueLabel, conversion)); }
/// <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="enumeratorInfo">The <see cref="EnumeratorInfo" /> property of the result.</param> /// <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="Variables" /> property of the result.</param> /// <param name="collection">The <see cref="Collection" /> property of the result.</param> /// <param name="conversion">The <see cref="Conversion"/> property of the result.</param> /// <param name="body">The <see cref="LoopCSharpStatement.Body" /> property of the result.</param> /// <param name="deconstruction">The <see cref="Deconstruction"/> property of the result.</param> /// <param name="awaitInfo">The <see cref="AwaitInfo"/> property of the result.</param> /// <returns>This expression if no children changed, or an expression with the updated children.</returns> public ForEachCSharpStatement Update(EnumeratorInfo enumeratorInfo, LabelTarget breakLabel, LabelTarget continueLabel, IEnumerable <ParameterExpression> variables, Expression collection, LambdaExpression conversion, Expression body, LambdaExpression deconstruction, AwaitInfo awaitInfo) { if (enumeratorInfo == EnumeratorInfo && breakLabel == BreakLabel && continueLabel == ContinueLabel && SameElements(ref variables, Variables) && collection == Collection && conversion == Conversion && body == Body && deconstruction == Deconstruction && awaitInfo == AwaitInfo) { return(this); } return(CSharpExpression.ForEach(awaitInfo, variables, collection, body, breakLabel, continueLabel, conversion, deconstruction)); }