Freigeben über


CodeAttributeDeclaration-Klasse

Stellt eine Attributdeklaration dar.

Namespace: System.CodeDom
Assembly: System (in system.dll)

Syntax

'Declaration
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
Public Class CodeAttributeDeclaration
'Usage
Dim instance As CodeAttributeDeclaration
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
public class CodeAttributeDeclaration
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
public ref class CodeAttributeDeclaration
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
public class CodeAttributeDeclaration
SerializableAttribute 
ComVisibleAttribute(true) 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
public class CodeAttributeDeclaration

Hinweise

Mit einer CodeAttributeDeclaration kann ein Ausdruck dargestellt werden, der ein Attribut deklariert. Der Attributname und die Argumente für das Attribut werden als Eigenschaften des Objekts gespeichert. Mit einem CodeAttributeArgument können alle Argumente für das Attribut dargestellt werden.

Beispiel

Im folgenden Codebeispiel wird eine CodeAttributeDeclaration erstellt, die ein CLSCompliantAttribute mit dem Argument false deklariert:

CodeAttributeDeclaration declaration1 = new CodeAttributeDeclaration(
    "System.CLSCompliantAttribute", 
    new CodeAttributeArgument(new CodePrimitiveExpression(false)));

// A C# code generator produces the following source code for the 
// preceeding example code:
// [CLSCompliantAttribute(false)]
Dim declaration1 As New CodeAttributeDeclaration( _
    "System.CLSCompliantAttribute", _
    new CodeAttributeArgument(new CodePrimitiveExpression(false)))

' A Visual Basic code generator produces the following source code 
' for the preceeding example code:
' <CLSCompliantAttribute(false)>

Vererbungshierarchie

System.Object
  System.CodeDom.CodeAttributeDeclaration

Threadsicherheit

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

CodeAttributeDeclaration-Member
System.CodeDom-Namespace
CodeAttributeDeclarationCollection
CodeAttributeArgument-Klasse