CodeCommentStatement 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表由單一評論組成的陳述。
public ref 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
[<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
- 繼承
- 屬性
範例
此範例示範使用 a CodeCommentStatement 來表示原始碼中的註解。
// 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 也可以加入 的 CodeNamespace 註解集合或任何源自 CodeTypeMember的物件中。
建構函式
| 名稱 | Description |
|---|---|
| CodeCommentStatement() |
初始化 CodeCommentStatement 類別的新執行個體。 |
| CodeCommentStatement(CodeComment) |
使用指定的註解初始化該類別的新實例 CodeCommentStatement 。 |
| CodeCommentStatement(String, Boolean) |
使用指定的文字與文件註解標誌初始化該類別的新實例 CodeCommentStatement 。 |
| CodeCommentStatement(String) |
使用指定的文字作為內容初始化類別的新 CodeCommentStatement 實例。 |
屬性
| 名稱 | Description |
|---|---|
| Comment |
取得或設定留言的內容。 |
| EndDirectives |
會得到 CodeDirectiveCollection 包含終端指令的物件。 (繼承來源 CodeStatement) |
| LinePragma |
取得或設定該代碼語句出現的行。 (繼承來源 CodeStatement) |
| StartDirectives |
會得到 CodeDirectiveCollection 一個包含啟動指令的物件。 (繼承來源 CodeStatement) |
| UserData |
取得目前物件的使用者可定義資料。 (繼承來源 CodeObject) |
方法
| 名稱 | Description |
|---|---|
| Equals(Object) |
判斷指定的 物件是否等於目前的物件。 (繼承來源 Object) |
| GetHashCode() |
做為預設雜湊函式。 (繼承來源 Object) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |