Open sandboxFocus

Interface IAttributeCollection

A read-only collection of IAttribute representing the custom attributes applied to a declaration.

Namespace: Metalama.Framework.Code.Collections
Assembly: Metalama.Framework.dll
Syntax
public interface IAttributeCollection : IReadOnlyCollection<IAttribute>, IEnumerable<IAttribute>, IEnumerable
Remarks

This collection is exposed via the Attributes property and provides methods to query attributes by type using OfAttributeType(IType) or check for attribute presence using Any(IType).

The order of items in this collection is undetermined and may change between versions.

To add attributes to existing declarations, use IntroduceAttribute. To add attributes to introduced declarations, use AddAttribute(AttributeConstruction). To remove attributes, use RemoveAttributes.

Methods

Name Description
Any(IType)

Determines whether the collection contains any attribute whose type is convertible to the specified type using the default conversion kind.

Any(IType, ConversionKind)

Determines whether the collection contains any attribute whose type is convertible to the specified type using the specified conversionKind.

Any(Type)

Determines whether the collection contains any attribute whose type is convertible to the specified reflection type using the default conversion kind.

Any(Type, ConversionKind)

Determines whether the collection contains any attribute whose type is convertible to the specified reflection type using the specified conversionKind.

GetConstructedAttributesOfType<T>()

Gets the constructed attributes of a given type.

OfAttributeType(IType)

Gets all attributes whose type is convertible to the specified type using the default conversion kind.

OfAttributeType(IType, ConversionKind)

Gets all attributes whose type is convertible to the specified type using the specified conversionKind.

OfAttributeType(Func<IType, bool>)

Gets all attributes whose type satisfies the specified predicate.

OfAttributeType(Type)

Gets all attributes whose type is convertible to the specified reflection type using the default conversion kind.

OfAttributeType(Type, ConversionKind)

Gets all attributes whose type is convertible to the specified reflection type using the specified conversionKind.

Extension Methods

See Also