Table of Contents

Class ExpressionParameterReplacer

Namespace
MongoDB.Driver.Linq
Assembly
MongoDB.Driver.Legacy.dll

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 ParameterExpression

The parameter to be replaced.

toExpression Expression

The 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 Expression

The expression containing the parameter that should be replaced.

fromParameter ParameterExpression

The from parameter.

toExpression Expression

The 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 ParameterExpression

The node.

Returns

Expression

The parameter (replaced if it matched).