CodeCommentStatement Classe

Definizione

Rappresenta un'istruzione costituita da un singolo commento.

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
Ereditarietà
CodeCommentStatement
Attributi

Esempio

In questo esempio viene illustrato l'uso di per CodeCommentStatement rappresentare un commento nel codice sorgente.

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

Commenti

CodeCommentStatement può essere usato per rappresentare un'istruzione di commento a riga singola. CodeCommentStatement è un'istruzione, quindi può essere inserita in un insieme di istruzioni e verrà visualizzata sulla propria riga. CodeCommentStatement può anche essere aggiunto all'insieme comments di CodeNamespace o a qualsiasi oggetto che deriva da CodeTypeMember.

Costruttori

Nome Descrizione
CodeCommentStatement()

Inizializza una nuova istanza della classe CodeCommentStatement.

CodeCommentStatement(CodeComment)

Inizializza una nuova istanza della CodeCommentStatement classe utilizzando il commento specificato.

CodeCommentStatement(String, Boolean)

Inizializza una nuova istanza della CodeCommentStatement classe utilizzando il testo e il flag di commento della documentazione specificati.

CodeCommentStatement(String)

Inizializza una nuova istanza della CodeCommentStatement classe utilizzando il testo specificato come contenuto.

Proprietà

Nome Descrizione
Comment

Ottiene o imposta il contenuto del commento.

EndDirectives

Ottiene un CodeDirectiveCollection oggetto che contiene direttive end.

(Ereditato da CodeStatement)
LinePragma

Ottiene o imposta la riga in cui si verifica l'istruzione del codice.

(Ereditato da CodeStatement)
StartDirectives

Ottiene un CodeDirectiveCollection oggetto contenente le direttive start.

(Ereditato da CodeStatement)
UserData

Ottiene i dati definibili dall'utente per l'oggetto corrente.

(Ereditato da CodeObject)

Metodi

Nome Descrizione
Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
GetHashCode()

Funge da funzione hash predefinita.

(Ereditato da Object)
GetType()

Ottiene il Type dell'istanza corrente.

(Ereditato da Object)
MemberwiseClone()

Crea una copia superficiale del Objectcorrente.

(Ereditato da Object)
ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Si applica a

Vedi anche