/// <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="variables">The <see cref="Variables" /> property of the result.</param>
        /// <param name="statements">The <see cref="Statements" /> property of the result.</param>
        /// <param name="returnLabel">The <see cref="ReturnLabel" /> property of the result.</param>
        /// <returns>This expression if no children changed, or an expression with the updated children.</returns>
        public BlockCSharpExpression Update(IEnumerable <ParameterExpression> variables, IEnumerable <Expression> statements, LabelTarget returnLabel)
        {
            if (variables == this.Variables && statements == this.Statements && returnLabel == this.ReturnLabel)
            {
                return(this);
            }

            return(CSharpExpression.Block(variables, statements, returnLabel));
        }
예제 #2
0
        /// <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="variables">The <see cref="Variables" /> property of the result.</param>
        /// <param name="statements">The <see cref="Statements" /> property of the result.</param>
        /// <param name="returnLabel">The <see cref="ReturnLabel" /> property of the result.</param>
        /// <returns>This expression if no children changed, or an expression with the updated children.</returns>
        public BlockCSharpExpression Update(IEnumerable <ParameterExpression> variables, IEnumerable <Expression> statements, LabelTarget returnLabel)
        {
            if (SameElements(ref variables, Variables) && SameElements(ref statements, Statements) && returnLabel == ReturnLabel)
            {
                return(this);
            }

            return(CSharpExpression.Block(variables, statements, returnLabel));
        }