Type 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。
public ref class Type abstract
public ref class Type abstract : System::Reflection::MemberInfo, System::Reflection::IReflect
public ref class Type abstract : System::Reflection::MemberInfo, System::Reflection::IReflect, System::Runtime::InteropServices::_Type
public abstract class Type
public abstract class Type : System.Reflection.MemberInfo, System.Reflection.IReflect
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Serializable]
public abstract class Type : System.Reflection.MemberInfo, System.Reflection.IReflect, System.Runtime.InteropServices._Type
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class Type : System.Reflection.MemberInfo, System.Reflection.IReflect, System.Runtime.InteropServices._Type
type Type = class
type Type = class
inherit MemberInfo
interface IReflect
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
type Type = class
inherit MemberInfo
interface _Type
interface IReflect
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Type = class
inherit MemberInfo
interface _Type
interface IReflect
Public MustInherit Class Type
Public MustInherit Class Type
Inherits MemberInfo
Implements IReflect
Public MustInherit Class Type
Inherits MemberInfo
Implements _Type, IReflect
- 繼承
-
Type
- 繼承
- 衍生
- 屬性
- 實作
範例
以下範例展示了 的 Type幾個代表性特徵。 C# typeof 運算子(Visual Basic 中的 GetType 運算子)用於取得代表 Type 的 String 物件。 從這個Type物件,該GetMethod方法用來得到代表過載的 MethodInfo ,String.Substring該過載取起始位置與長度。
為了識別過載簽名,程式碼範例建立一個臨時陣列,包含兩個 Type 物件,分別代表 int(Integer,Visual Basic中為 c2 /)。
範例程式碼使用 以MethodInfoSubstring呼叫字串「Hello, World!」的方法,並顯示結果。
using System;
using System.Reflection;
class Example3
{
static void Main()
{
Type t = typeof(String);
MethodInfo substr = t.GetMethod("Substring",
new Type[] { typeof(int), typeof(int) });
Object result =
substr.Invoke("Hello, World!", new Object[] { 7, 5 });
Console.WriteLine("{0} returned \"{1}\".", substr, result);
}
}
/* This code example produces the following output:
System.String Substring(Int32, Int32) returned "World".
*/
open System
let t = typeof<String>
let substr = t.GetMethod("Substring", [| typeof<int>; typeof<int> |])
let result = substr.Invoke("Hello, World!", [| 7; 5 |])
printfn $"{substr} returned \"{result}\"."
(* This code example produces the following output:
System.String Substring(Int32, Int32) returned "World".
*)
Imports System.Reflection
Module Example
Sub Main()
Dim t As Type = GetType(String)
Dim substr As MethodInfo = t.GetMethod("Substring", _
New Type() { GetType(Integer), GetType(Integer) })
Dim result As Object = _
substr.Invoke("Hello, World!", New Object() { 7, 5 })
Console.WriteLine("{0} returned ""{1}"".", substr, result)
End Sub
End Module
' This code example produces the following output:
'
'System.String Substring(Int32, Int32) returned "World".
備註
Type 類別是 System.Reflection 功能的根目錄,也是存取元數據的主要方式。 使用 Type 的成員來取得類型宣告、類型成員的相關信息(例如建構函式、方法、欄位、屬性和類別的事件),以及部署類別的模組和元件。
程序代碼不需要任何許可權,即可使用反映來取得類型及其成員的相關信息,而不論其存取層級為何。 程序代碼不需要任何許可權,即可使用反射來存取公用成員,或存取在一般編譯期間由於存取層級可見的其他成員。 不過,為了讓程式碼使用反射來存取通常無法存取的成員,例如私用或內部方法,或類別未繼承的受保護欄位,您的程式碼必須具有 ReflectionPermission。 請參閱 反射的安全性考慮。
Type 是允許多個實作的抽象基類。 系統一律會提供衍生類別 RuntimeType。 在反思時,所有以 Runtime 一詞開頭的類別在系統中每個物件只會創建一次,並支援比較運算。
Note
在多線程案例中,請勿鎖定 Type 物件,以便同步存取 static 數據。 沒有控制權的其他程式代碼也可能鎖定您的類別類型。 這可能會導致死結。 相反地,藉由鎖定私有 static 物件來同步存取靜態資料。
Note
衍生類別可以存取呼叫程式代碼基類的受保護成員。 此外,允許存取呼叫程式代碼的組件成員。 一般來說,如果您在早期綁定程式碼中可以存取,那麼在晚期綁定程式碼中也可以存取。
Note
擴充其他介面的介面不會繼承擴充介面中定義的方法。
Type 物件代表哪些類型?
此類別是安全線程;多個線程可以同時從此類型的實例讀取。 Type 類別的實體可以代表下列任何類型:
- 班級
- 值類型
- 陣列
- Interfaces
- 列舉項目
- 代表們
- 建構的泛型型別和泛型型別定義
- 建構泛型型別、泛型型別定義和泛型方法定義的型別引數和型別參數
擷取 Type 物件
您可以使用下列方式取得與特定類型相關聯的 Type 物件:
實例 Object.GetType 方法會傳回代表實例類型的 Type 物件。 由於所有 Managed 型別都衍生自 Object,因此可以在任何類型的實例上呼叫 GetType 方法。
下列範例會呼叫 Object.GetType 方法來判斷物件陣列中每個物件的運行時間類型。
object[] values = { "word", true, 120, 136.34, 'a' }; foreach (var value in values) Console.WriteLine($"{value} - type {value.GetType().Name}"); // The example displays the following output: // word - type String // True - type Boolean // 120 - type Int32 // 136.34 - type Double // a - type Charlet values: obj[] = [| "word"; true; 120; 136.34; 'a' |] for value in values do printfn $"{value} - type {value.GetType().Name}" // The example displays the following output: // word - type String // True - type Boolean // 120 - type Int32 // 136.34 - type Double // a - type CharModule Example1 Public Sub Main() Dim values() As Object = { "word", True, 120, 136.34, "a"c } For Each value In values Console.WriteLine("{0} - type {1}", value, value.GetType().Name) Next End Sub End Module ' The example displays the following output: ' word - type String ' True - type Boolean ' 120 - type Int32 ' 136.34 - type Double ' a - type Char靜態 Type.GetType 方法會傳回 Type 物件,代表其完整名稱所指定的類型。
Module.GetTypes、Module.GetType和 Module.FindTypes 方法會傳回
Type對象,這些物件代表模組中定義的類型。 第一個方法可用來取得模組中定義之所有公用和私用型別 Type 對象的數位。 (您可以透過Module或 Assembly.GetModule 方法,或透過 Assembly.GetModules 屬性取得 Type.Module 的實例。System.Reflection.Assembly 物件包含一些方法來擷取元件中定義的類別,包括 Assembly.GetType、Assembly.GetTypes和 Assembly.GetExportedTypes。
FindInterfaces 方法會傳回類型所支援的介面類型篩選清單。
GetElementType 方法會傳回代表 專案的
Type物件。GetInterfaces 和 GetInterface 方法會傳回代表型別所支援介面類型的 Type 物件。
GetTypeArray 方法會傳回 Type 對象的陣列,代表任意物件集所指定的型別。 物件會以類型為 Object的陣列來指定。
GetTypeFromProgID 和 GetTypeFromCLSID 方法適用於 COM 互作性。 它們會傳回 Type 物件,代表
ProgID或CLSID所指定的型別。GetTypeFromHandle 方法是為了互作性而提供。 它會傳回代表類別句柄所指定類型的
Type物件。C#
typeof運算子、C++typeid運算子,以及 Visual BasicGetType運算子會取得類型的Type物件。MakeGenericType 方法會傳回 Type 物件,代表建構的泛型型別,如果其 ContainsGenericParameters 屬性傳回
true,則為開放式建構型別,否則為封閉式建構型別。 只有在關閉泛型類型時,才能具現化。MakeArrayType、MakePointerType和 MakeByRefType 方法會分別傳回 Type 對象,這些物件分別代表指定類型的陣列、指定類型的指標,以及參考參數的類型(在 C# 中為
ref,在 Visual Basic 中為 'byref'ByRef)。
比較類型物件是否相等
代表型別的 Type 對像是唯一的;也就是說,如果兩個 Type 對象參考代表相同類型,則只會參考相同的物件。 這允許使用參考相等來比較 Type 物件。 下列範例會比較代表整數值數目的 Type 物件,以判斷它們是否屬於相同類型。
long number1 = 1635429;
int number2 = 16203;
double number3 = 1639.41;
long number4 = 193685412;
// Get the type of number1.
Type t = number1.GetType();
// Compare types of all objects with number1.
Console.WriteLine($"Type of number1 and number2 are equal: {Object.ReferenceEquals(t, number2.GetType())}");
Console.WriteLine($"Type of number1 and number3 are equal: {Object.ReferenceEquals(t, number3.GetType())}");
Console.WriteLine($"Type of number1 and number4 are equal: {Object.ReferenceEquals(t, number4.GetType())}");
// The example displays the following output:
// Type of number1 and number2 are equal: False
// Type of number1 and number3 are equal: False
// Type of number1 and number4 are equal: True
let number1 = 1635429L
let number2 = 16203
let number3 = 1639.41
let number4 = 193685412L
// Get the type of number1.
let t = number1.GetType()
// Compare types of all objects with number1.
printfn $"Type of number1 and number2 are equal: {Object.ReferenceEquals(t, number2.GetType())}"
printfn $"Type of number1 and number3 are equal: {Object.ReferenceEquals(t, number3.GetType())}"
printfn $"Type of number1 and number4 are equal: {Object.ReferenceEquals(t, number4.GetType())}"
// The example displays the following output:
// Type of number1 and number2 are equal: False
// Type of number1 and number3 are equal: False
// Type of number1 and number4 are equal: True
Module MExample1
Public Sub Main()
Dim number1 As Long = 1635429
Dim number2 As Integer = 16203
Dim number3 As Double = 1639.41
Dim number4 As Long = 193685412
' Get the type of number1.
Dim t As Type = number1.GetType()
' Compare types of all objects with number1.
Console.WriteLine("Type of number1 and number2 are equal: {0}",
Object.ReferenceEquals(t, number2.GetType()))
Console.WriteLine("Type of number1 and number3 are equal: {0}",
Object.ReferenceEquals(t, number3.GetType()))
Console.WriteLine("Type of number1 and number4 are equal: {0}",
Object.ReferenceEquals(t, number4.GetType()))
End Sub
End Module
' The example displays the following output:
' Type of number1 and number2 are equal: False
' Type of number1 and number3 are equal: False
' Type of number1 and number4 are equal: True
給實施者的注意事項
當你從 繼承 時 Type,必須覆蓋以下成員:
- Assembly
- AssemblyQualifiedName
- BaseType
- FullName
- GetAttributeFlagsImpl()
- GetConstructorImpl(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])
- GetConstructors(BindingFlags)
- GetElementType()
- GetEvent(String, BindingFlags)
- GetEvents(BindingFlags)
- GetField(String, BindingFlags)
- GetFields(BindingFlags)
- GetInterface(String, Boolean)
- GetInterfaces()
- GetMethodImpl(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])
- GetMethods(BindingFlags)
- GetNestedType(String, BindingFlags)
- GetNestedTypes(BindingFlags)
- GetProperties(BindingFlags)
- GetPropertyImpl(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])
- GUID
- HasElementTypeImpl()
- InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])
- IsArrayImpl()
- IsByRefImpl()
- IsCOMObjectImpl()
- IsPointerImpl()
- IsPrimitiveImpl()
- Module
- Namespace
- TypeHandle
- UnderlyingSystemType
- GetCustomAttributes(Boolean)
- GetCustomAttributes(Type, Boolean)
- IsDefined(Type, Boolean)
- Name
建構函式
| 名稱 | Description |
|---|---|
| Type() |
初始化 Type 類別的新執行個體。 |
欄位
| 名稱 | Description |
|---|---|
| Delimiter |
在 的命名空間 Type中分離名稱。 此欄位僅供讀取。 |
| EmptyTypes |
代表一個類型的 Type空陣列。 此欄位僅供讀取。 |
| FilterAttribute |
代表用於屬性的成員過濾器。 此欄位僅供讀取。 |
| FilterName |
代表用於名稱的大小寫區分成員過濾器。 此欄位僅供讀取。 |
| FilterNameIgnoreCase |
代表用於名稱的大小寫不區分成員過濾器。 此欄位僅供讀取。 |
| Missing |
代表資訊中的 Type 缺失值。 此欄位僅供讀取。 |
屬性
| 名稱 | Description |
|---|---|
| Assembly | |
| AssemblyQualifiedName |
取得該類型的組裝限定名稱,其中包含該 Type 物件載入的組裝名稱。 |
| Attributes |
取得與 Type相關聯的屬性。 |
| BaseType |
得到電流直接繼承的 Type 類型。 |
| ContainsGenericParameters |
會取得一個值,表示目前 Type 物件是否有未被特定型別取代的型別參數。 |
| CustomAttributes |
會獲得包含該成員自訂屬性的集合。 (繼承來源 MemberInfo) |
| DeclaringMethod |
若 當前MethodBase值代表泛型方法的型別參數,則會得到Type代表宣告方法的 。 |
| DeclaringType |
取得宣告目前巢狀型態或通用型態參數的型別。 |
| DefaultBinder |
會獲得預設綁定器的參考,該綁定器實作內部規則以選擇適合被呼叫 InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])的成員。 |
| FullName |
取得該類型的完全限定名稱,包括命名空間,但不含組合名稱。 |
| GenericParameterAttributes |
會獲得描述當前泛型參數協變性與特殊約束的旗 GenericParameterAttributes 標組合。 |
| GenericParameterPosition |
當 Type 該物件代表泛型型別或方法的型別參數時,取得該型別參數在宣告該參數的類型列表中的位置。 |
| GenericTypeArguments |
會取得此型別的通用型別參數陣列。 |
| GUID |
會獲得與 Type. 相關聯的 GUID。 |
| HasElementType | |
| IsAbstract |
會得到一個值,表示 是否 Type 為抽象且必須覆寫。 |
| IsAnsiClass |
會獲得一個值,表示是否選擇了字串格式屬性 |
| IsArray |
會得到一個值,表示該型別是否為陣列。 |
| IsAutoClass |
會獲得一個值,表示是否選擇了字串格式屬性 |
| IsAutoLayout |
會取得一個值,表示目前型態的欄位是否由公共語言執行時自動排列。 |
| IsByRef |
會得到一個值,表示是否 Type 透過參考傳遞。 |
| IsByRefLike |
會得到一個值,表示該型別是否為類似 byref 結構。 |
| IsClass |
會取得一個值,表示 是 Type 類別還是代理;也就是說,不是值型別或介面。 |
| IsCollectible |
獲得一個值,表示該 MemberInfo 物件是否參考收藏品 AssemblyLoadContext中一個或多個組件。 (繼承來源 MemberInfo) |
| IsCOMObject |
會得到一個值,表示 是否 Type 是 COM 物件。 |
| IsConstructedGenericType |
會得到一個值,表示此物件是否代表建構的泛型型別。 你可以建立建構型態的通用型實例。 |
| IsContextful |
會獲得一個值,表示是否 Type 可以在某個情境中被託管。 |
| IsEnum |
獲得一個值,表示電流 Type 是否代表一個枚舉。 |
| IsExplicitLayout |
會得到一個值,表示目前類型的欄位是否被明確指定在偏移量處排列。 |
| IsFunctionPointer |
會得到一個值,表示電流 Type 是否為函數指標。 |
| IsGenericMethodParameter |
會得到一個值,表示電流 Type 是否代表一般方法定義中的型別參數。 |
| IsGenericParameter |
會獲得一個值,表示電流 Type 是否代表一般類型或方法定義中的型別參數。 |
| IsGenericType |
會取得一個值,表示目前型別是否為通用型別。 |
| IsGenericTypeDefinition |
會得到一個值,表示電流 Type 是否代表一般型別定義,從而可構造其他一般型別。 |
| IsGenericTypeParameter |
會得到一個值,表示電流 Type 是否代表一般型別定義中的型別參數。 |
| IsImport |
會取得一個值,表示 是否 Type 套 ComImportAttribute 用了屬性,表示該函式庫是從 COM 類型函式庫匯入的。 |
| IsInterface |
會獲得一個值,表示 是 Type 介面;也就是說,不是類別或值型別。 |
| IsLayoutSequential |
會得到一個值,表示目前型態欄位是否依定義順序排列,或依照它們被指向元資料的順序排列。 |
| IsMarshalByRef |
獲得一個值,表示是否 Type 由參考編組。 |
| IsNested |
取得一個值,表示目前 Type 物件是否代表一個定義嵌套在另一個型別定義中的型別。 |
| IsNestedAssembly |
會獲得一個值,表示 是否 Type 巢狀且僅在其自身組件中可見。 |
| IsNestedFamANDAssem |
獲得一個值,表示 是否 Type 巢狀且僅對屬於其族群與組合的類別可見。 |
| IsNestedFamily |
會獲得一個值,表示 是否 Type 巢狀且僅在其族中可見。 |
| IsNestedFamORAssem |
會獲得一個值,表示 是 Type 巢狀且僅對屬於其族或自身組合的類別可見。 |
| IsNestedPrivate |
會獲得一個值,表示是否 Type 巢狀且宣告為私有。 |
| IsNestedPublic |
會取得一個值,表示類別是否巢狀且宣告為公開。 |
| IsNotPublic |
會得到一個值,表示是否 Type 未被宣告為公開。 |
| IsPointer |
會得到一個值,表示 是否 Type 是指標。 |
| IsPrimitive |
會得到一個值,表示 是否 Type 是原始型態之一。 |
| IsPublic |
會獲得一個值,表示是否 Type 被宣告為公開。 |
| IsSealed |
會得到一個值,表示是否 Type 被宣告為封存。 |
| IsSecurityCritical |
獲得一個值,表示目前類型在當前信任層級下是安全關鍵還是安全-關鍵,因此能執行關鍵操作。 |
| IsSecuritySafeCritical |
獲得一個值,表示目前類型在當前信任層級是否為安全安全關鍵;也就是說,它是否能執行關鍵操作,且是否能被透明程式碼存取。 |
| IsSecurityTransparent |
會獲得一個值,指示目前型別在目前信任層級是否透明,因此無法執行關鍵操作。 |
| IsSerializable |
已淘汰.
會得到一個值,表示 是否 Type 可二進位序列化。 |
| IsSignatureType |
會得到一個值,表示該型別是否為簽章型別。 |
| IsSpecialName |
會獲得一個值,表示該型別是否有需要特殊處理的名稱。 |
| IsSZArray |
得到一個值,表示該型別是否是只能表示下界為零的單維陣列的陣列型態。 |
| IsTypeDefinition |
會得到一個值,表示該型別是否為型別定義。 |
| IsUnicodeClass |
會獲得一個值,表示是否選擇了字串格式屬性 |
| IsUnmanagedFunctionPointer |
會得到一個值,表示該電流 Type 是否為未管理函數指標。 |
| IsValueType |
會得到一個值來表示 是否 Type 是值型別。 |
| IsVariableBoundArray |
會得到一個值,表示該型別是可以表示多維陣列的陣列型態,還是具有任意下界的陣列型態。 |
| IsVisible |
會得到一個值,表示程式碼是否 Type 能在組合語言外存取。 |
| MemberType |
會獲得 MemberTypes 一個值,表示該成員是型態或巢狀型。 |
| MetadataToken |
會得到一個識別元資料元素的值。 (繼承來源 MemberInfo) |
| Module |
取得定義電流 Type 的模組(DLL)。 |
| Name |
當在衍生類別中被覆寫時,會獲得目前型態的名稱。 |
| Name |
會取得現任成員的名字。 (繼承來源 MemberInfo) |
| Namespace |
取得 的命名空間。Type |
| ReflectedType |
取得用來取得該成員的類別物件。 |
| StructLayoutAttribute |
會得到 StructLayoutAttribute 描述當前類型配置的 。 |
| TypeHandle |
掌握電流 Type的控制。 |
| TypeInitializer |
取得該型別的初始化器。 |
| UnderlyingSystemType |
表示由代表此型態的共通語言執行時所提供的型別。 |
方法
操作員
| 名稱 | Description |
|---|---|
| Equality(Type, Type) |
表示兩個 Type 物體是否相等。 |
| Inequality(Type, Type) |
表示兩個 Type 物體是否不相等。 |
明確介面實作
| 名稱 | Description |
|---|---|
| _MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。 (繼承來源 MemberInfo) |
| _MemberInfo.GetType() |
取得 Type 一個代表該類別的 MemberInfo 物件。 (繼承來源 MemberInfo) |
| _MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr) |
擷取物件的類型資訊,可以用來取得介面的類型資訊。 (繼承來源 MemberInfo) |
| _MemberInfo.GetTypeInfoCount(UInt32) |
擷取物件提供的類型資訊介面數目 (0 或 1)。 (繼承來源 MemberInfo) |
| _MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
提供物件所公開屬性和方法的存取權。 (繼承來源 MemberInfo) |
| _Type.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。 |
| _Type.GetTypeInfo(UInt32, UInt32, IntPtr) |
擷取物件的類型資訊,可以用來取得介面的類型資訊。 |
| _Type.GetTypeInfoCount(UInt32) |
擷取物件提供的類型資訊介面數目 (0 或 1)。 |
| _Type.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
提供物件所公開屬性和方法的存取權。 |
擴充方法
| 名稱 | Description |
|---|---|
| GetConstructor(Type, Type[]) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetConstructors(Type, BindingFlags) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetConstructors(Type) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetCustomAttribute(MemberInfo, Type, Boolean) |
擷取指定類型的自訂屬性,套用於指定成員,並可選擇性地檢查該成員的祖先。 |
| GetCustomAttribute(MemberInfo, Type) |
擷取指定型別的自訂屬性,套用到指定成員。 |
| GetCustomAttribute<T>(MemberInfo, Boolean) |
擷取指定類型的自訂屬性,套用於指定成員,並可選擇性地檢查該成員的祖先。 |
| GetCustomAttribute<T>(MemberInfo) |
擷取指定型別的自訂屬性,套用到指定成員。 |
| GetCustomAttributes(MemberInfo, Boolean) |
擷取一套套用於指定成員的自訂屬性,並可選擇性地檢查該成員的祖先。 |
| GetCustomAttributes(MemberInfo, Type, Boolean) |
擷取一組指定類型的自訂屬性,套用於指定成員,並可選擇性檢查該成員的祖先。 |
| GetCustomAttributes(MemberInfo, Type) |
擷取一組指定類型的自訂屬性,套用到指定成員。 |
| GetCustomAttributes(MemberInfo) |
擷取一套套用於指定成員的自訂屬性集合。 |
| GetCustomAttributes<T>(MemberInfo, Boolean) |
擷取一組指定類型的自訂屬性,套用於指定成員,並可選擇性檢查該成員的祖先。 |
| GetCustomAttributes<T>(MemberInfo) |
擷取一組指定類型的自訂屬性,套用到指定成員。 |
| GetDefaultMembers(Type) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetEvent(Type, String, BindingFlags) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetEvent(Type, String) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetEvents(Type, BindingFlags) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetEvents(Type) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetField(Type, String, BindingFlags) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetField(Type, String) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetFields(Type, BindingFlags) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetFields(Type) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetGenericArguments(Type) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetInterfaces(Type) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetMember(Type, String, BindingFlags) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetMember(Type, String) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetMembers(Type, BindingFlags) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetMembers(Type) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetMetadataToken(MemberInfo) |
如果有的話,會獲得該成員的元資料標記。 |
| GetMethod(Type, String, BindingFlags) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetMethod(Type, String, Type[]) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetMethods(Type, BindingFlags) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetMethods(Type) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetNestedTypes(Type, BindingFlags) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetProperties(Type, BindingFlags) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetProperties(Type) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetProperty(Type, String, Type, Type[]) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetProperty(Type, String, Type) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetProperty(Type, String) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| GetRuntimeEvent(Type, String) |
擷取代表指定事件的物件。 |
| GetRuntimeEvents(Type) |
擷取一個集合,代表指定型別上定義的所有事件。 |
| GetRuntimeField(Type, String) |
擷取代表指定欄位的物件。 |
| GetRuntimeFields(Type) |
檢索一個集合,代表指定型別上定義的所有欄位。 |
| GetRuntimeMethod(Type, String, Type[]) |
擷取代表指定方法的物件。 |
| GetRuntimeMethods(Type) |
檢索一個集合,代表指定型別上定義的所有方法。 |
| GetRuntimeProperties(Type) |
擷取一個集合,代表指定型別上定義的所有屬性。 |
| GetRuntimeProperty(Type, String) |
擷取代表指定屬性的物件。 |
| GetTypeInfo(Type) |
回傳 TypeInfo 指定型別的表示。 |
| HasMetadataToken(MemberInfo) |
回傳一個值,表示指定成員是否有可用的元資料標記。 |
| IsAssignableFrom(Type, Type) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
| IsDefined(MemberInfo, Type, Boolean) |
表示是否將特定類型的自訂屬性套用於指定成員,並可選擇套用於其祖先。 |
| IsDefined(MemberInfo, Type) |
表示是否套用特定類型的自訂屬性給指定成員。 |
| IsInstanceOfType(Type, Object) |
代表型別宣告:類別類型、介面類型、陣列類型、值型別、列舉型別、型別參數、通用型別定義,以及開放或封閉構造的通用型別。 |
適用於
執行緒安全性
此類型是安全線程。