CodeTypeReference クラスとは? わかりやすく解説

CodeTypeReference クラス

型への参照表します

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

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

CodeTypeReference オブジェクトは、CodeDOM オブジェクトの型を表すために使用されます。CodeDOM の型に Type プロパティ設定されている場合、そのプロパティCodeTypeReference 型です。たとえば、CodeMemberField.Type プロパティは、フィールドデータ型を表す CodeTypeReference です。

CodeTypeReference は、Type オブジェクトまたは文字列で初期化できます一般に、この初期化には Type使用することをお勧めしますが、使用できない場合あります。このクラスインスタンス文字列初期化する場合には、すべての言語名前空間インポートサポートされているわけではないため、常に完全限定型を使用することを強くお勧めます。たとえば、単なる "Console"ではなく、"System.Console" を使用してください配列型は、配列の型オブジェクト内で渡すか、ランクパラメータとして受け入れコンストラクタ1 つ使用することによって、指定できます

BaseType プロパティは、参照する型の名前を指定します配列型への参照場合は、ArrayElementType プロパティ配列要素の型を示し、ArrayRank プロパティ配列次元の数を示します

使用例使用例

CodeTypeReference使用して型への参照を表す例を次に示します

' Creates a reference to the System.DateTime type.
Dim typeRef1 As New CodeTypeReference("System.DateTime")

' Creates a typeof expression for the specified type reference.
Dim typeof1 As New CodeTypeOfExpression(typeRef1)

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

'       GetType(System.DateTime)            
// Creates a reference to the System.DateTime type.
CodeTypeReference typeRef1 = new CodeTypeReference("System.DateTime");

// Creates a typeof expression for the specified type reference.
CodeTypeOfExpression typeof1 = new CodeTypeOfExpression(typeRef1);

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

//    typeof(System.DateTime);            
// Creates a reference to the System.DateTime type.
CodeTypeReference^ typeRef1 = gcnew CodeTypeReference( "System.DateTime"
 );

// Creates a typeof expression for the specified type reference.
CodeTypeOfExpression^ typeof1 = gcnew CodeTypeOfExpression( typeRef1 );

// A C# code generator produces the following source code for the preceeding
 example code:
//    typeof(System.DateTime);
// Creates a reference to the System.DateTime type.
CodeTypeReference typeRef1 = new CodeTypeReference("System.DateTime");
// Creates a typeof expression for the specified type reference.
CodeTypeOfExpression typeof1 = new CodeTypeOfExpression(typeRef1);
// A VJ# code generator produces the following source code for the 
// preceeding example code:    
//    System.DateTime.class.ToType();           
継承階層継承階層
System.Object
   System.CodeDom.CodeObject
    System.CodeDom.CodeTypeReference
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「CodeTypeReference クラス」の関連用語

CodeTypeReference クラスのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS