Update() публичный Метод

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.
public Update ( Expression switchValue, IEnumerable cases, Expression defaultBody ) : SwitchExpression
switchValue Expression The property of the result.
cases IEnumerable The property of the result.
defaultBody Expression The property of the result.
Результат SwitchExpression
Пример #1
0
        private Expression VisitSwitchExtracted(SwitchExpression node)
        {
            var visitedSwitchValue = node.SwitchValue;
            var visitedCases       = Visit(node.Cases, VisitSwitchCase);
            var visitedDefaultBody = Visit(node.DefaultBody);
            var updated            = node.Update(visitedSwitchValue, visitedCases, visitedDefaultBody);

            return(ValidateSwitch(node, updated));
        }
Пример #2
0
 /// <summary>
 /// Visits the children of the <see cref="SwitchExpression"/>.
 /// </summary>
 /// <param name="node">The expression to visit.</param>
 /// <returns>The modified expression, if it or any subexpression was modified;
 /// otherwise, returns the original expression.</returns>
 protected internal virtual Expression VisitSwitch(SwitchExpression node)
 {
     return(ValidateSwitch(
                node,
                node.Update(
                    Visit(node.SwitchValue),
                    Visit(node.Cases, VisitSwitchCase),
                    Visit(node.DefaultBody)
                    )
                ));
 }
 protected internal virtual Expression VisitSwitch(SwitchExpression node)
 {
     return(ValidateSwitch(node, node.Update(this.Visit(node.SwitchValue), Visit <SwitchCase>(node.Cases, new Func <SwitchCase, SwitchCase>(this.VisitSwitchCase)), this.Visit(node.DefaultBody))));
 }