Open sandboxFocus

Method AddAspectIfEligible

AddAspectIfEligible(Type, Func<TDeclaration, TTag, IAspect>, EligibleScenarios)

Adds an aspect to the current set of declarations but only if the aspect is eligible for the declaration. This overload is non-generic.

Declaration
void AddAspectIfEligible(Type aspectType, Func<out TDeclaration, out TTag, IAspect> createAspect, EligibleScenarios eligibility = EligibleScenarios.Inheritance | EligibleScenarios.Aspect)
Parameters
Type Name Description
Type aspectType

The exact type of the aspect returned by createAspect. It is not allowed to specify a base type in this parameter, only the exact type.

Func<TDeclaration, TTag, IAspect> createAspect

A function that returns the aspect for a given declaration.

EligibleScenarios eligibility

The scenarios for which the aspect may be eligible. The default value is Default | Inheritance. If None is provided, eligibility is not checked.

AddAspectIfEligible<TAspect>(Func<TDeclaration, TTag, TAspect>, EligibleScenarios)

Adds an aspect to the current set of declarations but only if the aspect is eligible for the declaration.

Declaration
void AddAspectIfEligible<TAspect>(Func<out TDeclaration, out TTag, TAspect> createAspect, EligibleScenarios eligibility = EligibleScenarios.Inheritance | EligibleScenarios.Aspect) where TAspect : class, IAspect<out TDeclaration>
Parameters
Type Name Description
Func<TDeclaration, TTag, TAspect> createAspect

A function that returns the aspect for a given declaration.

EligibleScenarios eligibility

The scenarios for which the aspect may be eligible. The default value is Default | Inheritance. If None is provided, eligibility is not checked.

Type Parameters
Name Description
TAspect