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

Type クラス

宣言表します。型には、クラス型インターフェイス型配列型値型列挙型型パラメータジェネリック型定義、およびオープン構築ジェネリック型またはクローズ構築ジェネリック型あります

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

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.None)> _
Public MustInherit Class
 Type
    Inherits MemberInfo
    Implements _Type, IReflect
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType.None)] 
public abstract class Type : MemberInfo, _Type,
 IReflect
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType::None)] 
public ref class Type abstract : public
 MemberInfo, _Type, IReflect
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.None) */ 
public abstract class Type extends MemberInfo
 implements _Type, IReflect
SerializableAttribute 
ComVisibleAttribute(true) 
ClassInterfaceAttribute(ClassInterfaceType.None) 
public abstract class Type extends
 MemberInfo implements _Type, IReflect
解説解説

TypeSystem.Reflection 機能ルートであり、メタデータアクセスするための主要手段です。コンストラクタメソッドフィールドプロパティクラスイベントクラス配置するモジュールアセンブリなどの型宣言に関する情報取得するには、Typeメンバ使用します

型を表す Type オブジェクト一意であり、2 つType オブジェクト参照が同じオブジェクト参照するのは、これら 2 つオブジェクトが同じ型を表す場合限られます。これにより、参照等価使用して Type オブジェクト比較できます

ReflectionPermission を使用しないと、コード読み込まれアセンブリパブリック メンバにしかアクセスできません。実際には、Object.GetType への無制限アクセスエクスポートされたパブリックな型への Type.GetType を使用したアクセス、GetTypeFromHandle へのアクセスなどが可能です。FullName および Attributes など、Typeプロパティ中にはReflectionPermission使用せずアクセスできるものもあります

Type は、複数実装を持つことができる抽象基本クラスです。システムは、必ず派生クラス RuntimeType を提供しますリフレクションでは、Runtime という語で始まるすべてのクラスシステム内のオブジェクトごとに 1 回だけ生成され、このクラス比較操作サポートします

メモメモ

マルチスレッド シナリオでは、static データへのアクセス同期化する目的Type オブジェクトロックしないでください制御できない他のコードによってクラスの型がロックされる可能性あります。これによりデッドロック発生することもあります代わりにプライベート static オブジェクトロックすることにより、静的データへのアクセス同期化させてください

このクラススレッド セーフであり、複数スレッド同時にこの型のインスタンスか読み込むことができますTypeインスタンスは、次に示すすべての型を表現できます

型に関連付けられた Type オブジェクトへの参照は、次の方法取得できます

継承時の注意 Type から継承する場合は、GUID、InvokeMember(String,BindingFlags,Binder,Object,Object[],ParameterModifier[],CultureInfo,String[])、ModuleAssembly、TypeHandle、FullNameNamespace、AssemblyQualifiedName、BaseType、GetConstructorImpl、GetConstructors(BindingFlags)、GetMethodImpl、GetMethods(BindingFlags)、GetField(String,BindingFlags)、GetFields(BindingFlags)、GetInterface(String,Boolean)、GetInterfaces、GetEvent(String,BindingFlags)、GetEvents(BindingFlags)、GetPropertyImpl、GetProperties(BindingFlags)、GetNestedType(String,BindingFlags)、GetNestedTypes(BindingFlags)、GetAttributeFlagsImpl、IsArrayImpl、IsByRefImpl、IsPointerImpl、IsPrimitiveImpl、IsCOMObjectImpl、GetElementType、HasElementTypeImpl、UnderlyingSystemType、MemberInfo.Name、MemberInfo.IsDefined、MemberInfo.GetCustomAttributes、および GetCustomAttributes の各メンバオーバーライドする必要があります

継承階層継承階層
System.Object
   System.Reflection.MemberInfo
    System.Type
       System.Reflection.Emit.EnumBuilder
       System.Reflection.Emit.GenericTypeParameterBuilder
       System.Reflection.Emit.TypeBuilder
       System.Reflection.TypeDelegator
スレッド セーフスレッド セーフ

この型は、スレッド セーフです。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「Type クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS