CodeComment Klasse

Definition

Stellt einen Kommentar dar.

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

Beispiele

In diesem Beispiel wird veranschaulicht, wie sie einen CodeComment Kommentar im Quellcode darstellen.

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

CodeCommentkann verwendet werden, um eine einzelne Zeilenkommentar darzustellen.

Ein CodeCommentStatement kann ein CodeComment enthalten und ermöglicht es, als Anweisung behandelt und als Code in einer Auflistung von Anweisungen generiert zu werden. Mehrzeilige Kommentare können mit mehreren CodeCommentStatement Objekten dargestellt werden.

Um einen Kommentar in ein CodeDOM-Diagramm einzuschließen, der als Quellcode generiert werden kann, fügen Sie einen CodeComment zu einem CodeCommentStatementhinzu, und fügen Sie dies der Anweisungsauflistung eines CodeMemberMethod oder der comments-Auflistung eines oder eines CodeNamespace beliebigen Objekts hinzu, das von abgeleitet wird CodeTypeMember.

Konstruktoren

CodeComment()

Initialisiert eine neue Instanz der CodeComment-Klasse.

CodeComment(String)

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

CodeComment(String, Boolean)

Initialisiert eine neue Instanz der CodeComment-Klasse unter Verwendung des angegebenen Textes und des angegebenen Flags für Dokumentationskommentare.

Eigenschaften

DocComment

Ruft einen Wert ab, der angibt, ob es sich bei dem Kommentar um einen Dokumentationskommentar handelt, oder legt diesen fest.

Text

Ruft den Text des Kommentars ab oder legt diesen fest.

UserData

Ruft die benutzerdefinierbaren Daten für das aktuelle Objekt ab.

(Geerbt von CodeObject)

Methoden

Equals(Object)

Bestimmt, ob das angegebene Objekt gleich dem aktuellen Objekt ist.

(Geerbt von Object)
GetHashCode()

Fungiert als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
ToString()

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

(Geerbt von Object)

Gilt für:

Weitere Informationen