CodeComment Osztály

Definíció

Megjegyzést jelöl.

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
Öröklődés
CodeComment
Attribútumok

Példák

Ez a példa azt mutatja be, hogy egy CodeComment megjegyzést használ a forráskódban.

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

Megjegyzések

CodeComment egysoros megjegyzést jelölhet.

Az A CodeCommentStatement tartalmazhat egy utasítást CodeComment , és lehetővé teszi, hogy utasításként kezelje, és kódként hozza létre egy utasításgyűjteményen belül. A többsoros megjegyzések több CodeCommentStatement objektummal is megjeleníthetők.

Ha hozzá szeretne adni egy megjegyzést egy Olyan CodeDOM-gráfhoz, amely a forráskódhoz hozható létre, adjon hozzá egy CodeComment megjegyzést, CodeCommentStatementmajd adja hozzá egy CodeMemberMethod vagy bármely olyan objektum megjegyzésgyűjteményéhez CodeNamespace , amelyből CodeTypeMemberszármazik.

Konstruktorok

Name Description
CodeComment()

Inicializálja a CodeComment osztály új példányát.

CodeComment(String, Boolean)

Inicializálja az osztály új példányát a CodeComment megadott szöveg- és dokumentáció-megjegyzésjelölővel.

CodeComment(String)

Inicializálja az osztály új példányát CodeComment a megadott szöveggel tartalomként.

Tulajdonságok

Name Description
DocComment

Lekéri vagy beállít egy értéket, amely jelzi, hogy a megjegyzés dokumentációs megjegyzés-e.

Text

Lekéri vagy beállítja a megjegyzés szövegét.

UserData

Lekéri az aktuális objektum felhasználó által definiálható adatait.

(Öröklődés forrása CodeObject)

Metódusok

Name Description
Equals(Object)

Meghatározza, hogy a megadott objektum egyenlő-e az aktuális objektummal.

(Öröklődés forrása Object)
GetHashCode()

Ez az alapértelmezett kivonatoló függvény.

(Öröklődés forrása Object)
GetType()

Lekéri az Type aktuális példányt.

(Öröklődés forrása Object)
MemberwiseClone()

Az aktuális Objectpéldány sekély másolatát hozza létre.

(Öröklődés forrása Object)
ToString()

Az aktuális objektumot jelképező sztringet ad vissza.

(Öröklődés forrása Object)

A következőre érvényes:

Lásd még