Open sandboxFocus

Class AttributeConstruction

Encapsulates the information necessary to create a custom attribute.

Inheritance
AttributeConstruction
Implements
Namespace: Metalama.Framework.Code.DeclarationBuilders
Assembly: Metalama.Framework.dll
Syntax
public sealed class AttributeConstruction : IAttributeData

Properties

Name Description
Constructor

Gets the attribute constructor.

ConstructorArguments

Gets the constructor arguments.

NamedArguments

Gets the named arguments, i.e. the assigned fields and properties. Note that the order may be important in case of non-trivial property setters.

Type

Gets the attribute type.

Methods

Name Description
Create(IConstructor, IReadOnlyList<TypedConstant>?, IReadOnlyList<KeyValuePair<string, TypedConstant>>?)

Creates a new AttributeConstruction by explicitly specifying the constructor and strongly-typed arguments.

Create(INamedType, IReadOnlyList<object?>?, IReadOnlyList<KeyValuePair<string, object?>>?)

Creates a new AttributeConstruction by specifying the INamedType of the attribute. The method will attempt to find a suitable constructor.

Create(Type, IReadOnlyList<object?>?, IReadOnlyList<KeyValuePair<string, object?>>?)

Creates a new AttributeConstruction by specifying the reflection Type of the attribute. The method will attempt to find a suitable constructor.