CodeCommentStatement 类

定义

表示由单个注释组成的语句。

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
继承
CodeCommentStatement
属性

示例

此示例演示如何使用 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也可以添加到注释集合或派生自CodeTypeMember的任何对象的注释集合CodeNamespace中。

构造函数

名称 说明
CodeCommentStatement()

初始化 CodeCommentStatement 类的新实例。

CodeCommentStatement(CodeComment)

使用指定的注释初始化类的新实例 CodeCommentStatement

CodeCommentStatement(String, Boolean)

使用指定的文本和文档注释标志初始化类的新实例 CodeCommentStatement

CodeCommentStatement(String)

使用指定文本作为内容初始化类的新实例 CodeCommentStatement

属性

名称 说明
Comment

获取或设置注释的内容。

EndDirectives

CodeDirectiveCollection获取包含结束指令的对象。

(继承自 CodeStatement)
LinePragma

获取或设置代码语句发生所在的行。

(继承自 CodeStatement)
StartDirectives

CodeDirectiveCollection获取包含 start 指令的对象。

(继承自 CodeStatement)
UserData

获取当前对象的用户可定义数据。

(继承自 CodeObject)

方法

名称 说明
Equals(Object)

确定指定的对象是否等于当前对象。

(继承自 Object)
GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅