Class ExpressionParameterReplacer
A class that replaces all occurences of one parameter with a different parameter.
public class ExpressionParameterReplacer : ExpressionVisitor
- Inheritance
-
ExpressionParameterReplacer
- Inherited Members
- Extension Methods
Constructors
ExpressionParameterReplacer(ParameterExpression, Expression)
Initializes a new instance of the ExpressionParameterReplacer class.
public ExpressionParameterReplacer(ParameterExpression fromParameter, Expression toExpression)
Parameters
fromParameter
ParameterExpressionThe parameter to be replaced.
toExpression
ExpressionThe expression that replaces the parameter.
Methods
ReplaceParameter(Expression, ParameterExpression, Expression)
Replaces all occurences of one parameter with a different parameter.
public static Expression ReplaceParameter(Expression node, ParameterExpression fromParameter, Expression toExpression)
Parameters
node
ExpressionThe expression containing the parameter that should be replaced.
fromParameter
ParameterExpressionThe from parameter.
toExpression
ExpressionThe expression that replaces the parameter.
Returns
- Expression
The expression with all occurrences of the parameter replaced.
VisitParameter(ParameterExpression)
Replaces the from parameter with the two parameter if it maches.
protected override Expression VisitParameter(ParameterExpression node)
Parameters
node
ParameterExpressionThe node.
Returns
- Expression
The parameter (replaced if it matched).