CodeCommentStatement Klass

Definition

Representerar en instruktion som består av en enda kommentar.

public ref class CodeCommentStatement : System::CodeDom::CodeStatement
public 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
type CodeCommentStatement = class
    inherit 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
Arv
CodeCommentStatement
Attribut

Exempel

Det här exemplet visar hur du använder en CodeCommentStatement för att representera en kommentar i källkoden.

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

Kommentarer

CodeCommentStatement kan användas för att representera en kommentarsinstruktur med en rad. CodeCommentStatement är en instruktion, så den kan infogas i en instruktionssamling och visas på sin egen rad. CodeCommentStatement kan också läggas till i kommentarssamlingen för CodeNamespace eller något objekt som härleds från CodeTypeMember.

Konstruktorer

Name Description
CodeCommentStatement()

Initierar en ny instans av CodeCommentStatement klassen.

CodeCommentStatement(CodeComment)

Initierar en ny instans av CodeCommentStatement klassen med den angivna kommentaren.

CodeCommentStatement(String, Boolean)

Initierar en ny instans av klassen med hjälp av CodeCommentStatement den angivna text- och dokumentationskommentarflaggan.

CodeCommentStatement(String)

Initierar en ny instans av CodeCommentStatement klassen med den angivna texten som innehåll.

Egenskaper

Name Description
Comment

Hämtar eller anger innehållet i kommentaren.

EndDirectives

Hämtar ett CodeDirectiveCollection objekt som innehåller slutdirektiv.

(Ärvd från CodeStatement)
LinePragma

Hämtar eller anger den rad där kodsatsen inträffar.

(Ärvd från CodeStatement)
StartDirectives

Hämtar ett CodeDirectiveCollection objekt som innehåller startdirektiv.

(Ärvd från CodeStatement)
UserData

Hämtar användardefinierbara data för det aktuella objektet.

(Ärvd från CodeObject)

Metoder

Name Description
Equals(Object)

Avgör om det angivna objektet är lika med det aktuella objektet.

(Ärvd från Object)
GetHashCode()

Fungerar som standard-hash-funktion.

(Ärvd från Object)
GetType()

Hämtar den aktuella instansen Type .

(Ärvd från Object)
MemberwiseClone()

Skapar en ytlig kopia av den aktuella Object.

(Ärvd från Object)
ToString()

Returnerar en sträng som representerar det aktuella objektet.

(Ärvd från Object)

Gäller för

Se även