System.Reflection.CustomAttributeNamedArgument Structure

Represents a named argument of a custom attribute in the reflection-only context.

See Also: CustomAttributeNamedArgument Members


public struct CustomAttributeNamedArgument


Code that is being examined in the reflection-only context cannot be executed, so it is not always possible to examine custom attributes by creating instances of them and then examining their properties, using methods like erload:System.Attribute.GetCustomAttributes, erload:System.Reflection.MemberInfo.GetCustomAttributes, and so on. If the code for the attribute type itself is loaded into the reflection-only context, it cannot be executed.

The System.Reflection.CustomAttributeNamedArgument structure is used by the System.Reflection.CustomAttributeData class to provide access to a named argument specified for a custom attribute instance, without executing the code of the corresponding property of the custom attribute type. The CustomAttributeNamedArgument.TypedValue property returns a System.Reflection.CustomAttributeTypedArgument structure that contains the type and value of the named argument.


Whether an argument is named or positional, you must access its type and value by using the System.Reflection.CustomAttributeTypedArgument structure.

To create instances of the System.Reflection.CustomAttributeData class, use the static erload:System.Reflection.CustomAttributeData.GetCustomAttributes factory method.


Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0