System.CodeDom.CodeComment Class

Assembly: System.dll
Namespace: System.CodeDom
Summary
Represents a comment.
C# Syntax:
[Serializable]
public class CodeComment : CodeObject
Remarks
CodeComment can be used to represent a single line comment. A CodeCommentStatement can contain a CodeComment and allows it to be treated as a statement and generated as code. Multi-line comments can be represented with multiple CodeCommentStatement objects.

To include a comment in a CodeDOM graph that can be generated to source code, add a CodeComment to a CodeCommentStatement, and add this to the statements collection of a CodeMemberMethod or to the comments collection of a CodeNamespace or any object that derives from CodeTypeMember.

See also:
System.CodeDom Namespace | CodeCommentStatement | CodeTypeMember.Comments

System.CodeDom.CodeComment Member List:

Public Constructors
ctor #1 Overloaded:
.ctor()

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Initializes a new instance of the CodeComment class.
ctor #2 Overloaded:
.ctor(string text)

Initializes a new instance of the CodeComment class with the specified text as contents.
ctor #3 Overloaded:
.ctor(string text, bool docComment)

Initializes a new instance of the CodeComment class using the specified text and documentation comment flag.
Public Properties
DocComment Read-write

Gets or sets a value that indicates whether the comment is a documentation comment.
Text Read-write

Gets or sets the text of the comment.
UserData
(inherited from System.CodeDom.CodeObject)
Read-only

See base class member description: System.CodeDom.CodeObject.UserData


Gets or sets the user-definable data for the current object.
Public Methods
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.CodeDom.CodeComment Member Details

Overloaded ctor #1
Summary
Initializes a new instance of the CodeComment class.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public CodeComment();

Return to top


Overloaded ctor #2
Summary
Initializes a new instance of the CodeComment class with the specified text as contents.
C# Syntax:
public CodeComment(
   string text
);
Parameters:

text

The contents of the comment.

Return to top


Overloaded ctor #3
Summary
Initializes a new instance of the CodeComment class using the specified text and documentation comment flag.
C# Syntax:
public CodeComment(
   string text,
   bool docComment
);
Parameters:

text

The contents of the comment.

docComment

true if the comment is a documentation comment; otherwise, false.

Return to top


Property: DocComment (read-write)
Summary
Gets or sets a value that indicates whether the comment is a documentation comment.
C# Syntax:
public bool DocComment {get; set;}
Remarks
Some languages support a special type of comment that will be extracted from the source code for documentation. This property can be used to designate whether the comment is a documentaion comment, which may generate a different syntax. An example of this is C#, which uses "//" for regular comments and "///" for documentation comments.

Return to top


Property: Text (read-write)
Summary
Gets or sets the text of the comment.
C# Syntax:
public string Text {get; set;}
Remarks
The text of this property should not contain line breaks. If multiple lines are required, multiple CodeComment objects should be defined.

Return to top


Property: UserData (read-only)
Inherited
See base class member description: System.CodeDom.CodeObject.UserData

Summary
Gets or sets the user-definable data for the current object.
C# Syntax:
public IDictionary UserData {get;}
Remarks


Notes to inheritors: An inheritor can design the way this user data is stored, retrieved, and used.

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~CodeComment();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.