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

CodeTypeDeclaration イベント


パブリック イベントパブリック イベント

  名前 説明
パブリック イベント PopulateBaseTypes BaseTypes コレクション最初にアクセスされたときに発生します
パブリック イベント PopulateMembers Members コレクション最初にアクセスされたときに発生します
参照参照

関連項目

CodeTypeDeclaration クラス
System.CodeDom 名前空間
CodeTypeDeclarationCollection
GeneratorSupport

CodeTypeDeclaration クラス

クラス構造体インターフェイス、または列挙体の型宣言表します

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

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

CodeTypeDeclaration使用してクラス構造体インターフェイス、または列挙体を宣言するコードを表すことができますCodeTypeDeclaration使用して別の型の中に入れになった型を宣言できます

BaseTypes プロパティは、宣言される型の 1 つ上の基本型指定します。Members プロパティは、型のメンバ格納します。これには、メソッドフィールドプロパティコメント、および他の型があります。TypeAttributes プロパティは、型宣言の TypeAttributes 値を示します。これはその型のカテゴリ示します。IsClass、IsStruct、IsEnum、および IsInterface の各メソッドは、それぞれ、その型がクラス型構造体型列挙体型、またはインターフェイス型かどうか示します

メモメモ

プログラミング言語によっては、参照型またはクラスの宣言しかサポートされないこともあります言語固有の CodeDOM コード ジェネレータインターフェイス列挙体、または値型宣言サポートしているかどうか調べるには、Supports メソッド呼び出して該当する GeneratorSupport フラグ調べます。DeclareInterfaces はインターフェイスサポート示し、DeclareEnums は列挙体のサポート示し、DeclareValueTypes は構造体などの値型サポート示します

1 つ宣言内に完結するクラスまたは構造体実装作成することも、複数宣言わたって実装することもできます。IsPartial プロパティは、型宣言が完全か、部分的かを示します部分的な宣言サポートされないコード ジェネレータもあるので、PartialTypes フラグ指定して Supports メソッド呼び出し、このサポートテストします

使用例使用例

CodeTypeDeclaration使用して型を宣言する例を次に示します

' Creates a new type declaration.
Dim newType As New CodeTypeDeclaration("TestType")
   ' name parameter indicates the name of the type.
   ' Sets the member attributes for the type to private.
   newType.Attributes = MemberAttributes.Private
   ' Sets a base class which the type inherits from.
   newType.BaseTypes.Add("BaseType")

' A Visual Basic code generator produces the following source code for
 the preceeding example code:

' Class TestType
'    Inherits BaseType
' End Class
// Creates a new type declaration.
CodeTypeDeclaration newType = new CodeTypeDeclaration(
    // name parameter indicates the name of the type.
    "TestType");
// Sets the member attributes for the type to private.
newType.Attributes = MemberAttributes.Private;
// Sets a base class which the type inherits from.
newType.BaseTypes.Add( "BaseType" );            

// A C# code generator produces the following source code for the preceeding
 example code:

// class TestType : BaseType
// {
// }
// Creates a new type declaration.

// name parameter indicates the name of the type.
CodeTypeDeclaration^ newType = gcnew CodeTypeDeclaration( "TestType" );

// Sets the member attributes for the type to private.
newType->Attributes = MemberAttributes::Private;

// Sets a base class which the type inherits from.
newType->BaseTypes->Add( "BaseType" );

// A C# code generator produces the following source code for the preceeding
 example code:
// class TestType : BaseType
// {
// }
// Creates a new type declaration.
CodeTypeDeclaration newType = new CodeTypeDeclaration(
    // name parameter indicates the name of the type.
    "TestType");

// Sets the member attributes for the type to private.
newType.set_Attributes(MemberAttributes.Private);

// Sets a base class which the type inherits from.
newType.get_BaseTypes().Add("BaseType");
// A VJ# code generator produces the following source code for the
// preceeding example code:
// class TestType extends BaseType
// {
// }
継承階層継承階層
System.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeTypeMember
      System.CodeDom.CodeTypeDeclaration
         System.CodeDom.CodeTypeDelegate
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CodeTypeDeclaration メンバ
System.CodeDom 名前空間
CodeTypeDeclarationCollection
GeneratorSupport

CodeTypeDeclaration コンストラクタ ()


CodeTypeDeclaration コンストラクタ

CodeTypeDeclaration クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
CodeTypeDeclaration () CodeTypeDeclaration クラス新しインスタンス初期化します。
CodeTypeDeclaration (String) 指定した名前を使用してCodeTypeDeclaration クラス新しインスタンス初期化します。
参照参照

関連項目

CodeTypeDeclaration クラス
CodeTypeDeclaration メンバ
System.CodeDom 名前空間

CodeTypeDeclaration コンストラクタ (String)


CodeTypeDeclaration プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ Attributes  メンバ属性取得または設定します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ BaseTypes 型の基本型取得します
パブリック プロパティ Comments  メンバコメント コレクション取得します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ CustomAttributes  メンバカスタム属性取得または設定します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ EndDirectives  メンバ終了ディレクティブ取得します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ IsClass 型がクラスまたは参照型かどうかを示す値を取得または設定します
パブリック プロパティ IsEnum 型が列挙かどうかを示す値を取得または設定します
パブリック プロパティ IsInterface 型がインターフェイスかどうかを示す値を取得または設定します
パブリック プロパティ IsPartial 宣言が完全か部分的かを示す値を取得または設定します
パブリック プロパティ IsStruct 型が値型 (構造体) かどうかを示す値を取得または設定します
パブリック プロパティ LinePragma  メンバステートメント発生する行を取得または設定します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ Members 表される型のクラス メンバコレクション取得します
パブリック プロパティ Name  メンバの名前を取得または設定します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ StartDirectives  メンバ開始ディレクティブ取得します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ TypeAttributes 型の属性取得または設定します
パブリック プロパティ TypeParameters 宣言型パラメータ取得します
パブリック プロパティ UserData  現在のオブジェクトユーザー定義可能なデータ取得または設定します。 ( CodeObject から継承されます。)
参照参照

関連項目

CodeTypeDeclaration クラス
System.CodeDom 名前空間
CodeTypeDeclarationCollection
GeneratorSupport

CodeTypeDeclaration メソッド


CodeTypeDeclaration メンバ

クラス構造体インターフェイス、または列挙体の型宣言表します

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド CodeTypeDeclaration オーバーロードされます。 CodeTypeDeclaration クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Attributes  メンバ属性取得または設定します。(CodeTypeMember から継承されます。)
パブリック プロパティ BaseTypes 型の基本型取得します
パブリック プロパティ Comments  メンバコメント コレクション取得します。(CodeTypeMember から継承されます。)
パブリック プロパティ CustomAttributes  メンバカスタム属性取得または設定します。(CodeTypeMember から継承されます。)
パブリック プロパティ EndDirectives  メンバ終了ディレクティブ取得します。(CodeTypeMember から継承されます。)
パブリック プロパティ IsClass 型がクラスまたは参照型かどうかを示す値を取得または設定します
パブリック プロパティ IsEnum 型が列挙かどうかを示す値を取得または設定します
パブリック プロパティ IsInterface 型がインターフェイスかどうかを示す値を取得または設定します
パブリック プロパティ IsPartial 宣言が完全か部分的かを示す値を取得または設定します
パブリック プロパティ IsStruct 型が値型 (構造体) かどうかを示す値を取得または設定します
パブリック プロパティ LinePragma  メンバステートメント発生する行を取得または設定します。(CodeTypeMember から継承されます。)
パブリック プロパティ Members 表される型のクラス メンバコレクション取得します
パブリック プロパティ Name  メンバの名前を取得または設定します。(CodeTypeMember から継承されます。)
パブリック プロパティ StartDirectives  メンバ開始ディレクティブ取得します。(CodeTypeMember から継承されます。)
パブリック プロパティ TypeAttributes 型の属性取得または設定します
パブリック プロパティ TypeParameters 宣言型パラメータ取得します
パブリック プロパティ UserData  現在のオブジェクトユーザー定義可能なデータ取得または設定します。(CodeObject から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
パブリック イベントパブリック イベント
  名前 説明
パブリック イベント PopulateBaseTypes BaseTypes コレクション最初にアクセスされたときに発生します
パブリック イベント PopulateMembers Members コレクション最初にアクセスされたときに発生します
参照参照

関連項目

CodeTypeDeclaration クラス
System.CodeDom 名前空間
CodeTypeDeclarationCollection
GeneratorSupport


このページでは「.NET Framework クラス ライブラリ リファレンス」からCodeTypeDeclarationを検索した結果を表示しています。
Weblioに収録されているすべての辞書からCodeTypeDeclarationを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からCodeTypeDeclaration を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CodeTypeDeclaration」の関連用語

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

   

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



CodeTypeDeclarationのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS