Table of Contents

Class ExpressionParameterReplacer

Namespace
LfrlAnvil.Expressions
Assembly
LfrlAnvil.Core.dll

Represents an expression tree rewriter capable of replacing ParameterExpression nodes by position.

public class ExpressionParameterReplacer : ExpressionVisitor
Inheritance
ExpressionParameterReplacer
Inherited Members
Extension Methods

Constructors

ExpressionParameterReplacer(ParameterExpression[], Expression[])

Creates a new ExpressionParameterReplacer instance.

public ExpressionParameterReplacer(ParameterExpression[] parametersToReplace, Expression[] replacements)

Parameters

parametersToReplace ParameterExpression[]

Collection of ParameterExpression nodes to replace.

replacements Expression[]

Collection of replacement Expression nodes.

Remarks

ParameterExpression nodes that do not exist in the parametersToReplace collection will be ignored. Replacement nodes are chosen by index, that is, if ParameterExpression exists in the parametersToReplace collection, then the index of its first occurrence is used to find its replacement in the replacements collection.

Methods

Visit(Expression?)

Dispatches the expression to one of the more specialized visit methods in this class.

public override Expression? Visit(Expression? node)

Parameters

node Expression

The expression to visit.

Returns

Expression

The modified expression, if it or any subexpression was modified; otherwise, returns the original expression.