CodeCommentStatement 類別
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示包含單一註解的陳述式 (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 來表示原始程式碼中的批注。
// 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。
Code |
初始化 CodeCommentStatement 類別的新執行個體。 |
Code |
使用指定的註解來初始化 CodeCommentStatement 類別的新執行個體。 |
Code |
使用指定的文字為內容來初始化 CodeCommentStatement 類別的新執行個體。 |
Code |
使用指定的文字和文件註解旗標來初始化 CodeCommentStatement 類別的新執行個體。 |
Comment |
取得或設定註解的內容。 |
End |
取得包含結尾指示詞的 CodeDirectiveCollection 物件。 (繼承來源 CodeStatement) |
Line |
取得或設定程式碼陳述式發生所在的行。 (繼承來源 CodeStatement) |
Start |
取得包含開頭指示詞的 CodeDirectiveCollection 物件。 (繼承來源 CodeStatement) |
User |
取得目前物件的使用者可定義資料。 (繼承來源 CodeObject) |
Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
Get |
做為預設雜湊函式。 (繼承來源 Object) |
Get |
取得目前執行個體的 Type。 (繼承來源 Object) |
Memberwise |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
To |
傳回代表目前物件的字串。 (繼承來源 Object) |
產品 | 版本 |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |