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

IAspectReceiver<TDeclaration>.RequireAspect Method

RequireAspect<TAspect>()

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.

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

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

Remarks

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.