Open sandboxFocus

Method Override

Override(IMethod, in MethodTemplateSelector, object?, object?)

Overrides the implementation of a method.

Declaration
IOverrideAdviceResult<IMethod> Override(IMethod targetMethod, in MethodTemplateSelector template, object? args = null, object? tags = null)
Parameters
Type Name Description
IMethod targetMethod

The method to override.

MethodTemplateSelector template

Name of a method in the aspect class whose implementation will be used as a template. This property must be annotated with TemplateAttribute. To select a different templates according to the kind of target method (such as async or iterator methods), use the constructor of the MethodTemplateSelector type. To specify a single template for all methods, pass a string.

object args

An object (typically of anonymous type) whose properties map to parameters or type parameters of the template method.

object tags

An optional opaque object of anonymous type passed to the template method and exposed under the Tags property of the meta API.

Returns
Type Description
IOverrideAdviceResult<IMethod>
See Also

Override(IConstructor, string, object?, object?)

Overrides the implementation of a constructor.

Declaration
IOverrideAdviceResult<IConstructor> Override(IConstructor targetConstructor, string template, object? args = null, object? tags = null)
Parameters
Type Name Description
IConstructor targetConstructor

The constructor to override.

string template

Name of a method in the aspect class whose implementation will be used as a template. This method must be annotated with TemplateAttribute.

object args

An object (typically of anonymous type) whose properties map to parameters or type parameters of the template method.

object tags

An optional opaque object of anonymous type passed to the template method and exposed under the Tags property of the meta API.

Returns
Type Description
IOverrideAdviceResult<IConstructor>

Override(IFieldOrProperty, string, object?)

Overrides a field or property by specifying a property template.

Declaration
IOverrideAdviceResult<IProperty> Override(IFieldOrProperty targetFieldOrProperty, string template, object? tags = null)
Parameters
Type Name Description
IFieldOrProperty targetFieldOrProperty

The field or property to override.

string template

The name of a property of the aspect class, with a getter, a setter, or both, whose implementation will be used as a template. This property must be annotated with TemplateAttribute.

object tags

An optional opaque object of anonymous type passed to the template property and exposed under the Tags property of the meta API.

Returns
Type Description
IOverrideAdviceResult<IProperty>
See Also