This documentation is archived and is not being maintained.

CustomAttributeTypedArgument.ArgumentType Property

Gets the type of the argument or of the array argument element.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

member ArgumentType : Type

Property Value

Type: System.Type
A Type object representing the type of the argument or of the array element.

For simple arguments or for elements of array arguments, this property identifies the actual type of the value returned by the Value property. For array arguments, this property returns the array type, but the Value property returns a ReadOnlyCollection<CustomAttributeTypedArgument> (ReadOnlyCollection(Of CustomAttributeTypedArgument) in Visual Basic) in which each element of the collection represents the corresponding element of the array argument.

The following example defines a custom attribute with four constructors and four properties. Two of the properties are read-only, and are set by using the positional parameters of the constructors. The other two properties are read/write, and can be set only by using named arguments. One positional property is an array of strings, and one named property is an array of integers.

The attribute is applied to the assembly, to a type declared in the assembly, to a method of the type, and to a parameter of the method. Different constructors are used for these cases. When executed, the assembly loads itself into the reflection-only context and displays the custom attributes.

The attribute that is applied to the type demonstrates array properties, with both positional and named arguments.

The ArgumentType property is used in the ShowValueOrArray method that displays custom attribute data, to display the types of attributes.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.