CodeTypeReference クラス
アセンブリ: System (system.dll 内)

<SerializableAttribute> _ <ComVisibleAttribute(True)> _ <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ Public Class CodeTypeReference Inherits CodeObject
[SerializableAttribute] [ComVisibleAttribute(true)] [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] public class CodeTypeReference : CodeObject
[SerializableAttribute] [ComVisibleAttribute(true)] [ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] public ref class CodeTypeReference : public 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.CodeDom.CodeObject
System.CodeDom.CodeTypeReference


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- CodeTypeReference クラスのページへのリンク