CodeCommentとは? わかりやすく解説

CodeComment クラス

コメントを表します。

名前空間: System.CodeDom
アセンブリ: System (system.dll 内)
構文構文

<SerializableAttribute> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class CodeComment
    Inherits CodeObject
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class CodeComment : CodeObject
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
[ComVisibleAttribute(true)] 
public ref class CodeComment : public
 CodeObject
/** @attribute SerializableAttribute() */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class CodeComment extends CodeObject
SerializableAttribute 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class CodeComment extends
 CodeObject
解説解説

CodeComment を使用して、単一行のコメントを表すことができます。

CodeCommentStatement は CodeComment を格納でき、それがステートメントとして扱われ、ステートメントのコレクション内のコードとして生成されるようにします。複数行のコメントは、複数の CodeCommentStatement オブジェクトを使用して表すことができます。

ソース コードを生成できる CodeDOM グラフにコメントを含めるには、CodeComment を CodeCommentStatement に追加し、それを CodeMemberMethod のステートメント コレクション、CodeNamespace のコメント コレクション、または CodeTypeMember から派生する任意のオブジェクトのコメント コレクションに追加します。

使用例使用例

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
// 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.

// 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("This comment was generated
 "
    + "from a System.CodeDom.CodeComment", false);
// The text of the comment.
// Whether the comment is a comment intended for documentation purposes.
// Create a CodeCommentStatement that contains the comment, in order
// to add the comment to a CodeTypeDeclaration Members collection.
CodeCommentStatement commentStatement = new 
    CodeCommentStatement(comment);
// A VJ# code generator produces the following source code for the 
// preceeding example code:
// This comment was generated from a System.CodeDom.CodeComment
継承階層継承階層
System.Object
   System.CodeDom.CodeObject
    System.CodeDom.CodeComment
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

CodeComment コンストラクタ ()


CodeComment コンストラクタ (String)


CodeComment コンストラクタ (String, Boolean)


CodeComment コンストラクタ


CodeComment プロパティ


CodeComment メソッド


CodeComment メンバ

コメントを表します。

CodeComment データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

CodeComment クラス
System.CodeDom 名前空間
CodeCommentStatement
Comments



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「CodeComment」の関連用語

CodeCommentのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



CodeCommentのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS