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 。 Visual Basic) 中的 C# typeof
運算子 (GetType
運算子是用來取得 Type 代表 的 String 物件。 從這個 Type 物件中 GetMethod ,方法會用來取得 , MethodInfo 表示 String.Substring 採用起始位置和長度的多載。
為了識別多載簽章,程式碼範例會建立暫存陣列,其中包含兩 Type 個物件,代表 int
Visual Basic) 中的 (Integer
。
程式碼範例會使用 MethodInfo 在字串 「Hello, World!」 上叫 Substring 用 方法,並顯示結果。
#using <System.dll>
using namespace System;
using namespace System::Reflection;
void main()
{
// Get a Type object representing the System.String type.
Type^ t = String::typeid;
MethodInfo^ substr = t->GetMethod("Substring",
gcnew array<Type^> { int::typeid, int::typeid });
Object^ result =
substr->Invoke("Hello, World!", gcnew array<Object^> { 7, 5 });
Console::WriteLine("{0} returned \"{1}\".", substr, result);
}
/* This code example produces the following output:
System.String Substring(Int32, Int32) returned "World".
*/
using System;
using System.Reflection;
class Example
{
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 這個字開頭的類別只會在系統中每個物件建立一次,並支援比較作業。
注意
在多執行緒案例中,請勿鎖定 Type 物件,以便同步處理資料的存取 static
。 您沒有控制項的其他程式碼也可能鎖定您的類別類型。 這可能會導致死結。 相反地,藉由鎖定私 static
用物件來同步處理靜態資料的存取。
注意
衍生類別可以存取呼叫程式碼基類的受保護成員。 此外,允許存取呼叫程式碼元件的元件成員。 一般來說,如果您允許在早期繫結程式碼中存取,則您也可以在晚期繫結程式碼中存取。
注意
擴充其他介面的介面不會繼承擴充介面中定義的方法。
本節內容:
Type 物件代表哪些類型?擷取 Type 物件比較相等的類型物件
Type 物件代表哪些類型?
這個類別是安全線程;多個執行緒可以同時從此類型的實例讀取。 類別的 Type 實例可以代表下列任何類型:
類別
值類型
陣列
介面
列舉
委派
建構的泛型型別和泛型型別定義
建構泛型型別、泛型型別定義和泛型方法定義的型別引數和型別參數
擷取 Type 物件
Type您可以透過下列方式取得與特定類型相關聯的 物件:
實例 Object.GetType 方法會傳 Type 回 物件,代表實例的類型。 因為所有 Managed 型別都衍生自 Object ,所以 GetType 可以在任何類型的實例上呼叫 方法。
下列範例會 Object.GetType 呼叫 方法,以判斷物件陣列中每個物件的執行時間類型。
using namespace System; void main() { array<Object^>^ values = { "word", true, 120, 136.34 }; for each (Object^ value in values) Console::WriteLine("{0} - type {1}", value, value->GetType()->Name); } // The example displays the following output: // word - type String // True - type Boolean // 120 - type Int32 // 136.34 - type Double
object[] values = { "word", true, 120, 136.34, 'a' }; foreach (var value in values) Console.WriteLine("{0} - type {1}", value, value.GetType().Name); // The example displays the following output: // word - type String // True - type Boolean // 120 - type Int32 // 136.34 - type Double // a - type Char
let 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 Char
Module Example 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 。 (您可以透過 Assembly.GetModule 或 Assembly.GetModules 方法,或透過 property.) 取得 的 Type.Module 實例Module
System.Reflection.Assembly物件包含許多方法來擷取元件中定義的類別,包括 Assembly.GetType 、 Assembly.GetTypes 和 Assembly.GetExportedTypes 。
方法 FindInterfaces 會傳回類型所支援的介面類別型篩選清單。
方法 GetElementType 會傳
Type
回 代表 專案的 物件。GetInterfaces和 GetInterface 方法會傳回 Type 物件,代表類型所支援的介面類別型。
方法 GetTypeArray 會傳回 物件陣列 Type ,代表任意物件集所指定的型別。 物件是使用 型 Object 別的陣列來指定。
和 GetTypeFromProgIDGetTypeFromCLSID 方法是針對 COM 互通性而提供。 它們會傳回 Type 物件,表示 或
CLSID
所指定的型別ProgID
。系統會 GetTypeFromHandle 提供 方法以取得互通性。 它會傳
Type
回 物件,代表類別控制碼所指定的型別。C#
typeof
運算子、C++typeid
運算子和 Visual BasicGetType
運算子會取得Type
類型的 物件。方法 MakeGenericType 會傳 Type 回物件,代表建構的泛型型別,如果其 ContainsGenericParameters 屬性傳回
true
,則為開放式建構型別,否則為封閉式建構型別。 只有在關閉泛型型別時,才能具現化。MakeArrayType、 MakePointerType 和 MakeByRefType 方法會傳回 Type 物件,分別代表指定型別的陣列、指定型別的指標,以及 F# 中為 'byref' 之 C#
ByRef
中 'byref' 的參考 (ref
參數類型,) 。
比較類型物件是否相等
Type表示類型的物件是唯一的;也就是說, Type 如果兩個物件參考代表相同的類型,則參考相同的物件。 這允許使用參考相等來 Type 比較物件。 下列範例會 Type 比較代表一些整數值的物件,以判斷它們是否屬於相同類型。
using namespace System;
void main()
{
Int64 number1 = 1635429;
Int32 number2 = 16203;
double number3 = 1639.41;
Int64 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: {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()));
}
// 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
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: {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()));
// 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 Example
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
時,必須覆寫下列成員:
GetConstructorImpl(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])
GetMethodImpl(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])
GetPropertyImpl(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])
建構函式
Type() |
初始化 Type 類別的新執行個體。 |
欄位
Delimiter |
分隔 Type 的命名空間中的名稱。 此欄位為唯讀。 |
EmptyTypes |
表示 Type 類型的空陣列。 此欄位為唯讀。 |
FilterAttribute |
表示用在屬性 (Attribute) 上的成員篩選條件。 此欄位為唯讀。 |
FilterName |
表示用於名稱上的有區分大小寫的成員篩選條件。 此欄位為唯讀。 |
FilterNameIgnoreCase |
表示用在名稱上的不區分大小寫的成員篩選條件。 此欄位為唯讀。 |
Missing |
表示在 Type 資訊中的遺漏值。 此欄位為唯讀。 |
屬性
Assembly | |
AssemblyQualifiedName |
取得類型的組件限定名稱,包含載入 Type 的組件名稱。 |
Attributes |
取得與 Type 關聯的屬性。 |
BaseType |
取得目前 Type 所直接繼承的類型。 |
ContainsGenericParameters |
取得值,該值指出目前的 Type 物件是否有尚未被特定類型取代的類型參數。 |
CustomAttributes |
取得包含此成員之自訂屬性的集合。 (繼承來源 MemberInfo) |
DeclaringMethod |
如果目前的 MethodBase 表示泛型方法的型別參數,則取得表示宣告方法的 Type。 |
DeclaringType |
取得宣告目前巢狀類型或泛型型別參數的類型。 |
DefaultBinder |
取得預設繫結器 (Binder) 的參考,它會實作內部規則來選取由 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 |
取得表示目前類型的欄位是否已由 Common Language Runtime 自動配置版面的值。 |
IsByRef |
取得值,指出 Type 是否以傳址方式傳遞。 |
IsByRefLike |
取得值,指出類型是否為 byref-like 結構。 |
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 屬性 (Attribute),亦即其是否從 COM 類型程式庫匯入。 |
IsInterface |
取得值,指出 Type 是否為介面;也就是說,不是類別或實值類型。 |
IsLayoutSequential |
取得表示目前類型的欄位是否已依為其定義或發出至中繼資料之順序,循序配置版面的值。 |
IsMarshalByRef |
取得值,指出 Type 是否以傳址方式封送處理。 |
IsNested |
取得值,表示目前的 Type 物件代表的類型之定義是否位於另一個類型的定義內部。 |
IsNestedAssembly |
取得值,指出 Type 是否為巢狀,並只在它自己的組件內為可見。 |
IsNestedFamANDAssem |
取得值,指出 Type 是否為巢狀,並只對同時屬於它自己家族和它自己組件的類別為可見。 |
IsNestedFamily |
取得值,指出 Type 是否為巢狀,並只在它自己的系列內為可見。 |
IsNestedFamORAssem |
取得值,指出 Type 是否為巢狀並只對屬於它自己家族或它自己組件的類別為可見。 |
IsNestedPrivate |
取得值,指出 Type 是否為巢狀並且宣告為私用。 |
IsNestedPublic |
取得值,指出類別是否為巢狀 (Nest) 並且宣告為公用 (Public)。 |
IsNotPublic |
取得值,指出 Type 是否未宣告為公用。 |
IsPointer |
取得值,指出 Type 是否為指標。 |
IsPrimitive |
取得值,指出 Type 是否為其中一個基本類型 (Primitive Type)。 |
IsPublic |
取得值,指出 Type 是否宣告為公用。 |
IsSealed |
取得值,指出 Type 是否宣告為密封。 |
IsSecurityCritical |
取得值,這個值表示目前類型在目前信任層級上是否為安全性關鍵或安全性安全關鍵,因而可以執行重要的作業。 |
IsSecuritySafeCritical |
取得值,這個值表示目前類型在目前信任層級上是否為安全性安全關鍵,也就是說,它是否能執行重要作業並由安全性透明的程式碼存取。 |
IsSecurityTransparent |
取得值,這個值表示目前類型在目前信任層級上是否為透明,因此無法執行重要作業。 |
IsSerializable |
已過時。
取得值,指出 是否 Type 可序列化二進位。 |
IsSignatureType |
取得值,指出類型是否為特徵標記類型。 |
IsSpecialName |
取得值,表示類型是否具有需要特殊處理的名稱。 |
IsSZArray |
取得值,指出類型是否為陣列類型,且只能代表下限為零的一維陣列。 |
IsTypeDefinition |
取得值,指出類型是否為類型定義。 |
IsUnicodeClass |
取得值,指出是否為 |
IsUnmanagedFunctionPointer |
取得值,這個值表示目前 Type 是否為 Unmanaged 函式指標。 |
IsValueType |
取得值,指出 Type 是否為實值類型。 |
IsVariableBoundArray |
取得值,指出類型是否為陣列類型,且可代表多維陣列或任意下限的陣列。 |
IsVisible |
取得一個值,表示位於組件之外的程式碼是否能存取 Type。 |
MemberType |
取得一個 MemberTypes 值,代表這個成員是類型或巢狀類型。 |
MetadataToken |
取得值,這個值可識別中繼資料項目。 (繼承來源 MemberInfo) |
Module |
在已定義的目前 Type 中取得模組 (DLL)。 |
Name |
在衍生類別中覆寫時,取得目前類型的名稱。 |
Name |
取得目前成員的名稱。 (繼承來源 MemberInfo) |
Namespace |
取得 Type 的命名空間。 |
ReflectedType |
取得用來取得這個成員的類別物件。 |
StructLayoutAttribute |
取得描述目前類型配置的 StructLayoutAttribute。 |
TypeHandle |
取得目前 Type 的控制代碼。 |
TypeInitializer |
取得類型的初始設定式。 |
UnderlyingSystemType |
指示類型,該類型是由表示這個類型的 Common Language Runtime 所提供的。 |
方法
運算子
Equality(Type, Type) |
表示兩個 Type 物件是否相等。 |
Inequality(Type, Type) |
表示兩個 Type 物件是否不相等。 |
明確介面實作
_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) |
提供物件所公開的屬性和方法的存取權。 |
擴充方法
GetCustomAttribute(MemberInfo, Type) |
擷取指定型別的自訂屬性,此屬性套用至指定成員。 |
GetCustomAttribute(MemberInfo, Type, Boolean) |
擷取只訂型別的自訂屬性,此屬性套用至指定成員,並且可選擇性檢查該成員的祖系。 |
GetCustomAttribute<T>(MemberInfo) |
擷取指定型別的自訂屬性,此屬性套用至指定成員。 |
GetCustomAttribute<T>(MemberInfo, Boolean) |
擷取只訂型別的自訂屬性,此屬性套用至指定成員,並且可選擇性檢查該成員的祖系。 |
GetCustomAttributes(MemberInfo) |
擷取套用至指定成員的自訂屬性集合。 |
GetCustomAttributes(MemberInfo, Boolean) |
擷取自訂屬性集合,此集合套用至指定成員,並且可選擇性檢查該成員的祖系。 |
GetCustomAttributes(MemberInfo, Type) |
擷取指定型別的自訂屬性集合,此集合套用至指定成員。 |
GetCustomAttributes(MemberInfo, Type, Boolean) |
擷取指定型別的自訂屬性集合,此集合套用至指定成員,並且可選擇性檢查該成員的祖系。 |
GetCustomAttributes<T>(MemberInfo) |
擷取指定型別的自訂屬性集合,此集合套用至指定成員。 |
GetCustomAttributes<T>(MemberInfo, Boolean) |
擷取指定型別的自訂屬性集合,此集合套用至指定成員,並且可選擇性檢查該成員的祖系。 |
IsDefined(MemberInfo, Type) |
指出是否將所指定型別的自訂屬性套用至指定的成員。 |
IsDefined(MemberInfo, Type, Boolean) |
指出指定之型別的自訂屬性是否會套用至指定的成員,以及選擇性地套用到其上階。 |
GetTypeInfo(Type) |
傳回指定之型別的 TypeInfo 表示。 |
GetMetadataToken(MemberInfo) |
取得指定成員的中繼資料語彙基元 (如果有)。 |
HasMetadataToken(MemberInfo) |
傳回值,指出所指定成員是否有可用的中繼資料語彙基元。 |
GetRuntimeEvent(Type, String) |
擷取表示指定之事件的物件。 |
GetRuntimeEvents(Type) |
擷取集合,表示指定的型別所定義的所有事件。 |
GetRuntimeField(Type, String) |
擷取表示指定之欄位的物件。 |
GetRuntimeFields(Type) |
擷取集合,表示指定的型別所定義的所有欄位。 |
GetRuntimeMethod(Type, String, Type[]) |
擷取表示指定之方法的物件。 |
GetRuntimeMethods(Type) |
擷取集合,表示指定的型別所定義的所有方法。 |
GetRuntimeProperties(Type) |
擷取集合,表示指定的型別所定義的所有屬性。 |
GetRuntimeProperty(Type, String) |
擷取表示指定之屬性的物件。 |
GetConstructor(Type, Type[]) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetConstructors(Type) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetConstructors(Type, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetDefaultMembers(Type) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetEvent(Type, String) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetEvent(Type, String, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetEvents(Type) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetEvents(Type, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetField(Type, String) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetField(Type, String, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetFields(Type) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetFields(Type, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetGenericArguments(Type) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetInterfaces(Type) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetMember(Type, String) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetMember(Type, String, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetMembers(Type) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetMembers(Type, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetMethod(Type, String) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetMethod(Type, String, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetMethod(Type, String, Type[]) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetMethods(Type) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetMethods(Type, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetNestedType(Type, String, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetNestedTypes(Type, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetProperties(Type) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetProperties(Type, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetProperty(Type, String) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetProperty(Type, String, BindingFlags) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetProperty(Type, String, Type) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
GetProperty(Type, String, Type, Type[]) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
IsAssignableFrom(Type, Type) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
IsInstanceOfType(Type, Object) |
代表類型宣告:類別類型、介面類型、陣列類型、值類型、列舉類型、類型參數、泛型類型定義,以及開放式或封閉式的建構泛型類型。 |
適用於
執行緒安全性
此型別具備執行緒安全。