Open sandboxFocus

Method AddAnnotation

AddAnnotation<TDeclaration>(IAdviser<TDeclaration>, IAnnotation<TDeclaration>, bool)

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. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one.

Declaration
public static void AddAnnotation<TDeclaration>(this IAdviser<TDeclaration> adviser, IAnnotation<TDeclaration> annotation, bool export = false) where TDeclaration : class, IDeclaration
Parameters
Type Name Description
IAdviser<TDeclaration> adviser

An adviser for a declaration.

IAnnotation<TDeclaration> annotation

The annotation.

bool 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.