/// <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="switchValue">The <see cref="SwitchValue" /> property of the result.</param> /// <param name="breakLabel">The <see cref="BreakLabel"/> property of the result.</param> /// <param name="variables">The <see cref="Variables" /> property of the result.</param> /// <param name="cases">The <see cref="Cases" /> property of the result.</param> /// <returns>This expression if no children changed, or an expression with the updated children.</returns> public SwitchCSharpStatement Update(Expression switchValue, LabelTarget breakLabel, IEnumerable <ParameterExpression> variables, IEnumerable <CSharpSwitchCase> cases) { if (switchValue == SwitchValue && breakLabel == BreakLabel && SameElements(ref variables, Variables) && SameElements(ref cases, Cases)) { return(this); } return(CSharpExpression.Switch(switchValue, breakLabel, variables, cases)); }
/// <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="switchValue">The <see cref="SwitchValue" /> property of the result.</param> /// <param name="breakLabel">The <see cref="BreakLabel"/> property of the result.</param> /// <param name="variables">The <see cref="Variables" /> property of the result.</param> /// <param name="cases">The <see cref="Cases" /> property of the result.</param> /// <returns>This expression if no children changed, or an expression with the updated children.</returns> public SwitchCSharpStatement Update(Expression switchValue, LabelTarget breakLabel, IEnumerable <ParameterExpression> variables, IEnumerable <CSharpSwitchCase> cases) { if (switchValue == this.SwitchValue && breakLabel == this.BreakLabel && variables == this.Variables && cases == this.Cases) { return(this); } return(CSharpExpression.Switch(switchValue, breakLabel, variables, cases)); }