MetalamaAPI documentationAspect APIMetalama.​Framework.​AdvisingIAdvice­FactoryAdd­Annotation
Open sandboxFocus

IAdviceFactory.AddAnnotation Method

AddAnnotation<TDeclaration>(TDeclaration, IAnnotation<TDeclaration>, Boolean)

Adds a custom annotation to a declaration. An annotation is an arbitrary but serializable object that can then be retrieved using the GetAnnotations<TAnnotation>() method of the Enhancements<T>(T) object. Annotations are a way of communication between aspects or classes of aspects.

Declaration
void AddAnnotation<TDeclaration>(TDeclaration declaration, IAnnotation<TDeclaration> annotation, bool export = false)
where TDeclaration : class, IDeclaration
Parameters
Type Name Description
TDeclaration declaration

The declaration to which the annotation should be added.

IAnnotation<TDeclaration> annotation

The annotation.

System.Boolean export

A value indicating whether the annotation should be exported and made visible to other projects. Unless this parameter is set to true, the annotation will only be visible to the current project.

Type Parameters
Name Description
TDeclaration

The type of declaration.