Metalama 1.0 / / Metalama Documentation / Aspect API / Metalama.​Framework.​Advising / IAdvice­Factory / Introduce­Finalizer

Method IntroduceFinalizer

IntroduceFinalizer(INamedType, String, OverrideStrategy, Object, Object)

Introduces a finalizer or overrides the implementation of the existing one.

Declaration
IIntroductionAdviceResult<IMethod> IntroduceFinalizer(INamedType targetType, string template, OverrideStrategy whenExists, object args = null, object tags = null)
Parameters
Type Name Description
INamedType targetType

The type into which the finalizer must be introduced.

String template

Name of the method of the aspect class that will be used as a template for the introduced finalizer. This method must be annotated with TemplateAttribute. This method can parameters and a return type. The actual parameters and return type of the introduced method can be modified using the IMethodBuilder returned by this method.

OverrideStrategy whenExists

Determines the implementation strategy when a finalizer is already declared in the target type. The default strategy is to fail with a compile-time error.

Object args

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

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
IIntroductionAdviceResult<IMethod>
See Also