Metalama 1.0 / / Metalama Documentation / Aspect API / Metalama.​Framework.​Eligibility / Eligibility­Extensions / Is­Aspect­Eligible

Method IsAspectEligible

IsAspectEligible<T>(IDeclaration, EligibleScenarios)

Determines whether the given declaration is an eligible target for a specified aspect type given as a type parameter.

Declaration
public static bool IsAspectEligible<T>(this IDeclaration declaration, EligibleScenarios scenarios)
where T : IAspect
Parameters
Type Name Description
IDeclaration declaration

The declaration for which eligibility is determined.

EligibleScenarios scenarios

The scenarios for which eligibility is determined. The default value is Aspect.

Returns
Type Description
Boolean

true if declaration is eligible for the aspect type T for any of the specified scenarios.

Type Parameters
Name Description
T

The aspect type.

IsAspectEligible(IDeclaration, Type, EligibleScenarios)

Determines whether the given declaration is an eligible target for a specified aspect type given as a reflection Type(IEligibilityBuilder<IHasType>).

Declaration
public static bool IsAspectEligible(this IDeclaration declaration, Type aspectType, EligibleScenarios scenarios)
Parameters
Type Name Description
IDeclaration declaration

The declaration for which eligibility is determined.

Type aspectType

The aspect type.

EligibleScenarios scenarios

The scenarios for which eligibility is determined. The default value is Aspect.

Returns
Type Description
Boolean

true if declaration is eligible for the given aspectType for any of the specified scenarios.