public sealed class CustomAttributeTypedData

Description

Represents a typed attribute parameter or element. This class is used by the reflection classes to provide detailed information about custom attributes and their data.

CustomAttributeTypedData allows access to the value of an attribute parameter or element, including its type and the actual data it holds. This is particularly useful when inspecting custom attributes applied to code elements at runtime.

Syntax

public sealed class CustomAttributeTypedData

Constructors

CustomAttributeTypedData()

Initializes a new instance of the CustomAttributeTypedData class.

public CustomAttributeTypedData()

Properties

ArgumentType

Gets the System.Type object that represents the type of the attribute argument.

public Type ArgumentType { get; }

Value

Gets the value of the attribute argument. The type of the returned value depends on the underlying data.

public object Value { get; }

Methods

ToString()

Returns a string representation of the current attribute typed data.

public override string ToString()

Remarks

CustomAttributeTypedData is an immutable representation of a single attribute argument or element. It is typically obtained when using methods like GetCustomAttributesData on a reflection object (e.g., Type, MethodInfo, PropertyInfo).

When working with arrays or nested custom attribute data, CustomAttributeTypedData will correctly represent the structure.