Represents the data of a custom attribute (type, constructor arguments, and named arguments) without its relationship to the containing declaration.
Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface IAttributeDataRemarks
This interface provides access to the intrinsic data of a custom attribute. It is implemented by both IAttribute (for attributes in the code model) and AttributeConstruction (for creating new attributes programmatically).
Values of ConstructorArguments and NamedArguments are represented as:
- Primitive types as themselves (e.g.,
intasint,stringasstring). - Enums as their underlying type.
- Type as IType.
- Arrays as
IReadOnlyList<object>.
To introduce an attribute to a declaration using this interface, pass an IAttributeData instance to IntroduceAttribute(IAdviser<IDeclaration>, IAttributeData, OverrideStrategy). Use Create(IConstructor, IReadOnlyList<TypedConstant>?, IReadOnlyList<KeyValuePair<string, TypedConstant>>?) to create a new IAttributeData programmatically.
Properties
| Name | Description |
|---|---|
| Constructor | Gets the constructor to be used to instantiate the custom attribute. |
| ConstructorArguments | Gets the parameters passed to the Constructor. |
| NamedArguments | Gets the named arguments (either fields or properties) of the attribute. |
| Type | Gets the custom attribute type. |