System.CodeDom.CodeAttributeArgument Class

Represents an argument used in a metadata attribute declaration.

See Also: CodeAttributeArgument Members


public class CodeAttributeArgument


System.CodeDom.CodeAttributeArgument can be used to represent either the value for a single argument of an attribute constructor, or a value with which to initialize a property of the attribute.

The CodeAttributeArgument.Value property indicates the value of the argument. The CodeAttributeArgument.Name property, when used, indicates the name of a property of the attribute to which to assign the value.

Attribute declarations are frequently initialized with a number of arguments that are passed into the constructor of the attribute at run time. To provide arguments to the constructor for an attribute, add a System.CodeDom.CodeAttributeArgument for each argument to the CodeAttributeDeclaration.Arguments collection of a System.CodeDom.CodeAttributeDeclaration. Only the CodeAttributeArgument.Value property of each System.CodeDom.CodeAttributeArgument needs to be initialized. The order of arguments within the collection must correspond to the order of arguments in the method signature of the constructor for the attribute.

You can also set properties of the attribute that are not available through the constructor by providing a System.CodeDom.CodeAttributeArgument that indicates the name of the property to set, along with the value to set.


Namespace: System.CodeDom
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0,,