Metalama 1.0 / / Metalama Documentation / Aspect API / Metalama.​Framework.​Code / Declaration­Enhancements<T> / Get­Aspects

Method GetAspects

GetAspects<TAspect>()

Gets the set of instances of a specified type of aspects that have been applied to a specified declaration.

Declaration
public IEnumerable<TAspect> GetAspects<TAspect>()
where TAspect : IAspect<T>
Returns
Type Description
IEnumerable<TAspect>

The set of aspects of exact type T applied on the current Metalama.Framework.Code.DeclarationEnhancements`1.Declaration.

Type Parameters
Name Description
TAspect

The exact type of aspects.

Remarks

You can call this method only for aspects that have been already been applied or are being applied, i.e. you can query aspects that are applied before the current aspect, or you can query instances of the current aspects applied in a parent class.