CodeCommentStatement CodeCommentStatement CodeCommentStatement CodeCommentStatement Class

定義

表示包含單一註解的陳述式 (Statement)。Represents a statement consisting of a single comment.

public ref class CodeCommentStatement : System::CodeDom::CodeStatement
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeCommentStatement : System.CodeDom.CodeStatement
type CodeCommentStatement = class
    inherit CodeStatement
Public Class CodeCommentStatement
Inherits CodeStatement
繼承
CodeCommentStatementCodeCommentStatementCodeCommentStatementCodeCommentStatement
屬性

範例

這個範例示範如何使用CodeCommentStatement來代表原始程式碼中的批註。This example demonstrates using a CodeCommentStatement to represent a comment in source code.

// 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 can be used to represent a single-line comment statement. CodeCommentStatement是語句, 因此可以插入語句集合中, 並且會顯示在它自己的行上。CodeCommentStatement is a statement, so it can be inserted into a statements collection and will appear on its own line. CodeCommentStatement也可以加入至的批註集合CodeNamespace或衍生自CodeTypeMember的任何物件。CodeCommentStatement can also be added to the comments collection of CodeNamespace or any object that derives from CodeTypeMember.

建構函式

CodeCommentStatement() CodeCommentStatement() CodeCommentStatement() CodeCommentStatement()

初始化 CodeCommentStatement 類別的新執行個體。Initializes a new instance of the CodeCommentStatement class.

CodeCommentStatement(CodeComment) CodeCommentStatement(CodeComment) CodeCommentStatement(CodeComment) CodeCommentStatement(CodeComment)

使用指定的註解來初始化 CodeCommentStatement 類別的新執行個體。Initializes a new instance of the CodeCommentStatement class using the specified comment.

CodeCommentStatement(String) CodeCommentStatement(String) CodeCommentStatement(String) CodeCommentStatement(String)

使用指定的文字為內容來初始化 CodeCommentStatement 類別的新執行個體。Initializes a new instance of the CodeCommentStatement class using the specified text as contents.

CodeCommentStatement(String, Boolean) CodeCommentStatement(String, Boolean) CodeCommentStatement(String, Boolean) CodeCommentStatement(String, Boolean)

使用指定的文字和文件註解旗標來初始化 CodeCommentStatement 類別的新執行個體。Initializes a new instance of the CodeCommentStatement class using the specified text and documentation comment flag.

屬性

Comment Comment Comment Comment

取得或設定註解的內容。Gets or sets the contents of the comment.

EndDirectives EndDirectives EndDirectives EndDirectives

取得包含結尾指示詞的 CodeDirectiveCollection 物件。Gets a CodeDirectiveCollection object that contains end directives.

(Inherited from CodeStatement)
LinePragma LinePragma LinePragma LinePragma

取得或設定程式碼陳述式發生所在的行。Gets or sets the line on which the code statement occurs.

(Inherited from CodeStatement)
StartDirectives StartDirectives StartDirectives StartDirectives

取得包含開頭指示詞的 CodeDirectiveCollection 物件。Gets a CodeDirectiveCollection object that contains start directives.

(Inherited from CodeStatement)
UserData UserData UserData UserData

取得目前物件的使用者可定義資料。Gets the user-definable data for the current object.

(Inherited from CodeObject)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於

另請參閱