MetalamaAPI documentationAspect APIMetalama.​Framework.​AspectsIAspect­Receiver<TDeclaration>Require­Aspect
Open sandboxFocus

Method RequireAspect


Requires an instance of a specified aspect type to be present on a specified declaration. If the aspect is not present, this method adds a new instance of the aspect by using the default aspect constructor.

void RequireAspect<TAspect>()
where TAspect : class, IAspect<TDeclaration>, new()
Type Parameters
Name Description

Type of the aspect. The type must be ordered after the aspect type calling this method.


Calling this method causes the current aspect to be present in the Predecessors list even if the required aspect was already present on the target declaration.