System.CodeDom.CodeAttributeDeclaration Class

Assembly: System.dll
Namespace: System.CodeDom
Summary
Represents an attribute declaration.
C# Syntax:
[Serializable]
public class CodeAttributeDeclaration
Remarks
CodeAttributeDeclaration can be used to represent an expression that declares an attribute. The attribute name and the arguments for the attribute are stored as properties of this object. CodeAttributeArgument can be used to represent each argument for the attribute.
Example
The following code creates a CodeAttributeDeclaration that declares a CLSCompliantAttribute named with an argument of false:
          CodeAttributeDeclaration declaration1 = new CodeAttributeDeclaration("System.CLSCompliantAttribute", new CodeAttributeArgument(new CodePrimitiveExpression(false)));
        

This code generates the following output when compiled from a CodeDOM graph:

"[CLSCompliantAttribute=false]"

See also:
System.CodeDom Namespace | CodeAttributeDeclarationCollection | CodeAttributeArgument

System.CodeDom.CodeAttributeDeclaration Member List:

Public Constructors
ctor #1 Overloaded:
.ctor()

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Initializes a new instance of the CodeAttributeDeclaration class.
ctor #2 Overloaded:
.ctor(string name)

Initializes a new instance of the CodeAttributeDeclaration class using the specified name.
ctor #3 Overloaded:
.ctor(string name, params CodeAttributeArgument[] arguments)

Initializes a new instance of the CodeAttributeDeclaration class using the specified name and arguments.
Public Properties
Arguments Read-only

Gets the arguments for the attribute.
Name Read-write

Gets or sets the name of the attribute being declared.
Public Methods
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.CodeDom.CodeAttributeDeclaration Member Details

Overloaded ctor #1
Summary
Initializes a new instance of the CodeAttributeDeclaration class.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public CodeAttributeDeclaration();

Return to top


Overloaded ctor #2
Summary
Initializes a new instance of the CodeAttributeDeclaration class using the specified name.
C# Syntax:
public CodeAttributeDeclaration(
   string name
);
Parameters:

name

The name of the attribute.

Return to top


Overloaded ctor #3
Summary
Initializes a new instance of the CodeAttributeDeclaration class using the specified name and arguments.
C# Syntax:
public CodeAttributeDeclaration(
   string name,
   params CodeAttributeArgument[] arguments
);
Parameters:

name

The name of the attribute.

arguments

The arguments for the attribute.

Return to top


Property: Arguments (read-only)
Summary
Gets the arguments for the attribute.
C# Syntax:
public CodeAttributeArgumentCollection Arguments {get;}
See also:
CodeAttributeArgumentCollection

Return to top


Property: Name (read-write)
Summary
Gets or sets the name of the attribute being declared.
C# Syntax:
public string Name {get; set;}

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~CodeAttributeDeclaration();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.