CodeCommentStatement 類別

定義

表示包含單一註解的陳述式 (Statement)。

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
繼承
CodeCommentStatement
屬性

範例

此範例示範如何使用 CodeCommentStatement 來表示原始程式碼中的批注。

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

備註

CodeCommentStatement 可用來表示單行批注語句。 CodeCommentStatement 是語句,因此可以插入語句集合中,並會出現在自己的行上。 CodeCommentStatement也可以新增至 的批注集合,或任何衍生自 CodeTypeMember的物件CodeNamespace

建構函式

CodeCommentStatement()

初始化 CodeCommentStatement 類別的新執行個體。

CodeCommentStatement(CodeComment)

使用指定的註解來初始化 CodeCommentStatement 類別的新執行個體。

CodeCommentStatement(String)

使用指定的文字為內容來初始化 CodeCommentStatement 類別的新執行個體。

CodeCommentStatement(String, Boolean)

使用指定的文字和文件註解旗標來初始化 CodeCommentStatement 類別的新執行個體。

屬性

Comment

取得或設定註解的內容。

EndDirectives

取得包含結尾指示詞的 CodeDirectiveCollection 物件。

(繼承來源 CodeStatement)
LinePragma

取得或設定程式碼陳述式發生所在的行。

(繼承來源 CodeStatement)
StartDirectives

取得包含開頭指示詞的 CodeDirectiveCollection 物件。

(繼承來源 CodeStatement)
UserData

取得目前物件的使用者可定義資料。

(繼承來源 CodeObject)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱