AttributeElement Class

An attribute applied to an assembly, a type, a member or a parameter.

public sealed class AttributeElement

Properties

NameDescription
ConstructorArgumentsGets the arguments of the constructor. A value is a primitive value, a String, a TypeReference for typeof, an IReadOnlyList<T> of values for an array, or null. The list is empty when the values cannot be decoded, for instance when an enum type cannot be found.
NamedArgumentsGets the values of the properties and fields set by the attribute, by name. The values have the same shape as AttributeElement.ConstructorArguments.
TypeGets the type of the attribute.

ConstructorArguments

AttributeElement.cs

Gets the arguments of the constructor. A value is a primitive value, a String, a TypeReference for typeof, an IReadOnlyList<T> of values for an array, or null. The list is empty when the values cannot be decoded, for instance when an enum type cannot be found.

public IReadOnlyList<object?> ConstructorArguments { get; }

NamedArguments

AttributeElement.cs

Gets the values of the properties and fields set by the attribute, by name. The values have the same shape as AttributeElement.ConstructorArguments.

public IReadOnlyDictionary<string, object?> NamedArguments { get; }

Gets the type of the attribute.

public TypeReference Type { get; }

Property value

TypeReference

Methods

NameDescription
ToString()Returns the type of the attribute.

Returns the type of the attribute.

public override string ToString()

Returns

string The type of the attribute.