Table of Contents

Class SetExpressionRewriter

Namespace
NMF.Expressions
Assembly
NMF.Expressions.dll

An expression visitor that turns getter functions into setters

public class SetExpressionRewriter : ExpressionVisitor
Inheritance
SetExpressionRewriter
Inherited Members
Extension Methods

Constructors

SetExpressionRewriter(Expression)

Create a new instance

public SetExpressionRewriter(Expression value)

Parameters

value Expression

The expression that is going to be inverted

Properties

Value

Gets the value of the rewrite

public Expression Value { get; set; }

Property Value

Expression

Methods

CreateSetter(LambdaExpression)

Create a setter for the given getter expression

public static LambdaExpression CreateSetter(LambdaExpression getter)

Parameters

getter LambdaExpression

The getter expression

Returns

LambdaExpression

An expression that corresponds to the setter of the given getter

CreateSetter<TValue>(Expression<Func<TValue>>)

Create a setter for the given getter expression

public static Expression<Action<TValue>> CreateSetter<TValue>(Expression<Func<TValue>> getter)

Parameters

getter Expression<Func<TValue>>

The getter expression

Returns

Expression<Action<TValue>>

An expression that corresponds to the setter of the given getter

Type Parameters

TValue

The return type of the getter expression

CreateSetter<T, TValue>(Expression<Func<T, TValue>>)

Create a setter for the given getter expression

public static Expression<Action<T, TValue>> CreateSetter<T, TValue>(Expression<Func<T, TValue>> getter)

Parameters

getter Expression<Func<T, TValue>>

The getter expression

Returns

Expression<Action<T, TValue>>

An expression that corresponds to the setter of the given getter

Type Parameters

T

The type of the first parameter

TValue

The return type of the getter expression

CreateSetter<T1, T2, TValue>(Expression<Func<T1, T2, TValue>>)

Create a setter for the given getter expression

public static Expression<Action<T1, T2, TValue>> CreateSetter<T1, T2, TValue>(Expression<Func<T1, T2, TValue>> getter)

Parameters

getter Expression<Func<T1, T2, TValue>>

The getter expression

Returns

Expression<Action<T1, T2, TValue>>

An expression that corresponds to the setter of the given getter

Type Parameters

T1

The type of the first parameter

T2

The type of the second parameter

TValue

The return type of the getter expression

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.

VisitBinary(BinaryExpression)

Visits the children of the BinaryExpression.

protected override Expression VisitBinary(BinaryExpression node)

Parameters

node BinaryExpression

The expression to visit.

Returns

Expression

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

VisitConditional(ConditionalExpression)

Visits the children of the ConditionalExpression.

protected override Expression VisitConditional(ConditionalExpression node)

Parameters

node ConditionalExpression

The expression to visit.

Returns

Expression

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

VisitDefault(DefaultExpression)

Visits the DefaultExpression.

protected override Expression VisitDefault(DefaultExpression node)

Parameters

node DefaultExpression

The expression to visit.

Returns

Expression

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

VisitElementInit(ElementInit)

Visits the children of the ElementInit.

protected override ElementInit VisitElementInit(ElementInit node)

Parameters

node ElementInit

The expression to visit.

Returns

ElementInit

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

VisitIndex(IndexExpression)

Visits the children of the IndexExpression.

protected override Expression VisitIndex(IndexExpression node)

Parameters

node IndexExpression

The expression to visit.

Returns

Expression

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

VisitListInit(ListInitExpression)

Visits the children of the ListInitExpression.

protected override Expression VisitListInit(ListInitExpression node)

Parameters

node ListInitExpression

The expression to visit.

Returns

Expression

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

VisitMember(MemberExpression)

Visits the children of the MemberExpression.

protected override Expression VisitMember(MemberExpression node)

Parameters

node MemberExpression

The expression to visit.

Returns

Expression

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

VisitMemberAssignment(MemberAssignment)

Visits the children of the MemberAssignment.

protected override MemberAssignment VisitMemberAssignment(MemberAssignment node)

Parameters

node MemberAssignment

The expression to visit.

Returns

MemberAssignment

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

VisitMemberInit(MemberInitExpression)

Visits the children of the MemberInitExpression.

protected override Expression VisitMemberInit(MemberInitExpression node)

Parameters

node MemberInitExpression

The expression to visit.

Returns

Expression

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

VisitMemberListBinding(MemberListBinding)

Visits the children of the MemberListBinding.

protected override MemberListBinding VisitMemberListBinding(MemberListBinding node)

Parameters

node MemberListBinding

The expression to visit.

Returns

MemberListBinding

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

VisitMemberMemberBinding(MemberMemberBinding)

Visits the children of the MemberMemberBinding.

protected override MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding node)

Parameters

node MemberMemberBinding

The expression to visit.

Returns

MemberMemberBinding

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

VisitMethodCall(MethodCallExpression)

Visits the children of the MethodCallExpression.

protected override Expression VisitMethodCall(MethodCallExpression node)

Parameters

node MethodCallExpression

The expression to visit.

Returns

Expression

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

VisitNew(NewExpression)

Visits the children of the NewExpression.

protected override Expression VisitNew(NewExpression node)

Parameters

node NewExpression

The expression to visit.

Returns

Expression

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

VisitNewArray(NewArrayExpression)

Visits the children of the NewArrayExpression.

protected override Expression VisitNewArray(NewArrayExpression node)

Parameters

node NewArrayExpression

The expression to visit.

Returns

Expression

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

VisitParameter(ParameterExpression)

Visits the ParameterExpression.

protected override Expression VisitParameter(ParameterExpression node)

Parameters

node ParameterExpression

The expression to visit.

Returns

Expression

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

VisitUnary(UnaryExpression)

Visits the children of the UnaryExpression.

protected override Expression VisitUnary(UnaryExpression node)

Parameters

node UnaryExpression

The expression to visit.

Returns

Expression

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