CodeCommentStatement Class
Represents a statement consisting of a single comment.
For a list of all members of this type, see CodeCommentStatement Members.
System.Object
System.CodeDom.CodeObject
System.CodeDom.CodeStatement
System.CodeDom.CodeCommentStatement
[Visual Basic] <Serializable> <ClassInterface(ClassInterfaceType.AutoDispatch)> <ComVisible(True)> Public Class CodeCommentStatement Inherits CodeStatement [C#] [Serializable] [ClassInterface(ClassInterfaceType.AutoDispatch)] [ComVisible(true)] public class CodeCommentStatement : CodeStatement [C++] [Serializable] [ClassInterface(ClassInterfaceType::AutoDispatch)] [ComVisible(true)] public __gc class CodeCommentStatement : public CodeStatement [JScript] public Serializable ClassInterface(ClassInterfaceType.AutoDispatch) ComVisible(true) class CodeCommentStatement extends CodeStatement
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
CodeCommentStatement can be used to represent a single-line comment statement. CodeCommentStatement is a statement, so it can be inserted into a statements collection and will appear on its own line. CodeCommentStatement can also be added to the comments collection of CodeNamespace or any object that derives from CodeTypeMember.
Example
[Visual Basic, C#, C++] This example demonstrates using a CodeCommentStatement to represent a comment in source code.
[Visual Basic] ' 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 [C#] // 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 [C++] // Create a CodeComment with some example comment text. CodeComment* comment = new CodeComment( // The text of the comment. S"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
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.CodeDom
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System (in System.dll)
See Also
CodeCommentStatement Members | System.CodeDom Namespace | CodeComment