CodeCommentStatement Klasse

Definition

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

public ref class CodeCommentStatement : System::CodeDom::CodeStatement
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeCommentStatement : System.CodeDom.CodeStatement
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeCommentStatement = class
    inherit CodeStatement
Public Class CodeCommentStatement
Inherits CodeStatement
Vererbung
CodeCommentStatement
Attribute

Beispiele

In diesem Beispiel wird die Verwendung eines CodeCommentStatement Kommentars im Quellcode veranschaulicht.

// 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.
     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

Hinweise

CodeCommentStatement kann verwendet werden, um eine einzeilige Kommentar-Anweisung darzustellen. CodeCommentStatement ist eine Anweisung, sodass sie in eine Anweisungsauflistung eingefügt werden kann und in einer eigenen Zeile angezeigt wird. CodeCommentStatement kann auch der Kommentarauflistung oder einem CodeNamespace objekt hinzugefügt werden, von dem abgeleitet wird CodeTypeMember.

Konstruktoren

Name Beschreibung
CodeCommentStatement()

Initialisiert eine neue Instanz der CodeCommentStatement-Klasse.

CodeCommentStatement(CodeComment)

Initialisiert eine neue Instanz der CodeCommentStatement Klasse mithilfe des angegebenen Kommentars.

CodeCommentStatement(String, Boolean)

Initialisiert eine neue Instanz der CodeCommentStatement Klasse mithilfe des angegebenen Text- und Dokumentationskommentar-Flags.

CodeCommentStatement(String)

Initialisiert eine neue Instanz der CodeCommentStatement Klasse mit dem angegebenen Text als Inhalt.

Eigenschaften

Name Beschreibung
Comment

Dient zum Abrufen oder Festlegen des Inhalts des Kommentars.

EndDirectives

Ruft ein CodeDirectiveCollection Objekt ab, das Enddirektiven enthält.

(Geerbt von CodeStatement)
LinePragma

Ruft die Zeile ab, in der die Code-Anweisung auftritt, oder legt sie fest.

(Geerbt von CodeStatement)
StartDirectives

Ruft ein CodeDirectiveCollection Objekt ab, das Startdirektiven enthält.

(Geerbt von CodeStatement)
UserData

Ruft die vom Benutzer definierbaren Daten für das aktuelle Objekt ab.

(Geerbt von CodeObject)

Methoden

Name Beschreibung
Equals(Object)

Bestimmt, ob das angegebene Objekt dem aktuellen Objekt entspricht.

(Geerbt von Object)
GetHashCode()

Dient als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft die Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie der aktuellen Object.

(Geerbt von Object)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Gilt für:

Weitere Informationen