Open sandboxFocus

Method Remove

Remove(dynamic?)

Generates run-time code that removes a handler, given a run-time C# expression, from the event.

Declaration
dynamic Remove(dynamic? handler)
Parameters
Type Name Description
dynamic handler

A run-time C# expression representing the event handler. If the compile-time type of the expression is dynamic, it must be explicitly cast to IExpression.

Returns
Type Description
dynamic

An internal Metalama statement object representing the event handler addition. It should be ignored in user code.

Remarks

By default, the event is accessed on the current object (this), unless the event is static. The base implementation of the event is invoked, i.e. the implementation before the current aspect layer. To change the default values, use the WithOptions(InvokerOptions) method.

Remove(IExpression)

Generates run-time code that removes a handler, given as an IExpression, from the event.

Declaration
dynamic Remove(IExpression handler)
Parameters
Type Name Description
IExpression handler

A compile-time IExpression representing the event handler.

Returns
Type Description
dynamic

An internal Metalama statement object representing the event handler addition. It should be ignored in user code.

Remarks

By default, the event is accessed on the current object (this), unless the event is static. The base implementation of the event is invoked, i.e. the implementation before the current aspect layer. To change the default values, use the WithOptions(InvokerOptions) method.