Update() public method

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 ( System.Linq.Expressions.ParameterExpression variable, Expression filter, Expression body ) : CatchBlock
variable System.Linq.Expressions.ParameterExpression The property of the result.
filter Expression The property of the result.
body Expression The property of the result.
return CatchBlock
Esempio n. 1
0
            protected override CatchBlock VisitCatchBlock(CatchBlock node)
            {
                if (node.Variable != null)
                {
                    _environment.Push(new[] { node.Variable });
                }

                //
                // Just visit children to perform inlining of constants or defaults. Note that the parent
                // try expression requires that non-trivial bindings are satisfied by the protected region
                // so we don't have to worry about that over here.
                //

                var filter = Visit(node.Filter);
                var body   = Visit(node.Body);

                if (node.Variable != null)
                {
                    _environment.Pop();
                }

                return(node.Update(node.Variable, filter, body));
            }
Esempio n. 2
0
 private CatchBlock VisitCatchBlockExtracted(CatchBlock node)
 {
     return(node.Update(node.Variable == null ? null : VisitAndConvert(node.Variable, nameof(VisitCatchBlock)), Visit(node.Filter), Visit(node.Body)));
 }
Esempio n. 3
0
 /// <summary>
 /// Visits the children of the <see cref="CatchBlock"/>.
 /// </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 virtual CatchBlock VisitCatchBlock(CatchBlock node)
 {
     return(node.Update(VisitAndConvert(node.Variable, nameof(VisitCatchBlock)), Visit(node.Filter), Visit(node.Body)));
 }
 protected virtual CatchBlock VisitCatchBlock(CatchBlock node)
 {
     return(node.Update(this.VisitAndConvert <ParameterExpression>(node.Variable, "VisitCatchBlock"), this.Visit(node.Filter), this.Visit(node.Body)));
 }