Freigeben über


CodeCommentStatement-Klasse

Stellt eine Anweisung dar, die aus einem einzelnen Kommentar besteht.

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

Syntax

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

Hinweise

Mit der CodeCommentStatement-Klasse kann eine einzeilige Kommentaranweisung dargestellt werden. CodeCommentStatement ist eine Anweisung, die somit in eine Anweisungsauflistung eingefügt werden kann und dort in einer eigenen Zeile aufgeführt wird. CodeCommentStatement kann auch der Kommentarauflistung von CodeNamespace oder einem beliebigen von CodeTypeMember abgeleiteten Objekt hinzugefügt werden.

Beispiel

In diesem Beispiel wird veranschaulicht, wie mit der CodeCommentStatement-Klasse ein Kommentar in Quellcode dargestellt wird.

' Create a CodeComment with some example comment text.
Dim comment As New CodeComment( _
   "This comment was generated from a System.CodeDom.CodeComment", _
   False) ' Whether the comment is a documentation comment.

' Create a CodeCommentStatement that contains the comment, in order
' to add the comment to a CodeTypeDeclaration Members collection.
Dim commentStatement As New CodeCommentStatement(comment)    

' A Visual Basic code generator produces the following source code for the preceeding example code:
    
' 'This comment was generated from a System.CodeDom.CodeComment
// Create a CodeComment with some example comment text.
CodeComment comment = new CodeComment(
    // The text of the comment.
    "This comment was generated from a System.CodeDom.CodeComment",
    // Whether the comment is a comment intended for documentation purposes.
    false );

// Create a CodeCommentStatement that contains the comment, in order
// to add the comment to a CodeTypeDeclaration Members collection.
CodeCommentStatement commentStatement = new CodeCommentStatement( comment );

// A C# code generator produces the following source code for the preceeding example code:

// // This comment was generated from a System.CodeDom.CodeComment
// Create a CodeComment with some example comment text.

// The text of the comment.
// Whether the comment is a comment intended for documentation purposes.
CodeComment^ comment = gcnew CodeComment( "This comment was generated from a System.CodeDom.CodeComment",false );

// Create a CodeCommentStatement that contains the comment, in order
// to add the comment to a CodeTypeDeclaration Members collection.
CodeCommentStatement^ commentStatement = gcnew CodeCommentStatement( comment );

// A C# code generator produces the following source code for the preceeding example code:
// // This comment was generated from a System.CodeDom.CodeComment
// Create a CodeComment with some example comment text.
CodeComment comment = new CodeComment("This comment was generated "
    + "from a System.CodeDom.CodeComment", false);
// The text of the comment.
// Whether the comment is a comment intended for documentation purposes.
// Create a CodeCommentStatement that contains the comment, in order
// to add the comment to a CodeTypeDeclaration Members collection.
CodeCommentStatement commentStatement = new 
    CodeCommentStatement(comment);
// A VJ# code generator produces the following source code for the 
// preceeding example code:
// This comment was generated from a System.CodeDom.CodeComment

Vererbungshierarchie

System.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeStatement
      System.CodeDom.CodeCommentStatement

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

CodeCommentStatement-Member
System.CodeDom-Namespace
CodeComment-Klasse