Open sandboxFocus
  • TOC

Metalama Documentation

Getting started

Conceptual documentation

Commented examples

API documentation

Aspect API

Metalama.​Framework.​Advising

Metalama.​Framework.​Aspects

Metalama.​Framework.​Code

Metalama.​Framework.​Code.​Collections

Metalama.​Framework.​Code.​Comparers

Metalama.​Framework.​Code.​Declaration­Builders

Metalama.​Framework.​Code.​Invokers

Metalama.​Framework.​Code.​Syntax­Builders

Metalama.​Framework.​Code.​Types

Metalama.​Framework.​Diagnostics

Metalama.​Framework.​Eligibility

Metalama.​Framework.​Fabrics

Metalama.​Framework.​Metrics

Metalama.​Framework.​Options

Metalama.​Framework.​Project

Metalama.​Framework.​Run­Time

Metalama.​Framework.​Serialization

Metalama.​Framework.​Services

Metalama.​Framework.​Utilities

Extensions API

Patterns API

Flashtrace API

Introspection API

Advanced API

Post­Sharp API migration

  • Article

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.

  • Navigation