_Type.GetConstructor 方法

定義

為 COM 物件提供與版本無關的 GetConstructor 方法之存取權。

多載

GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

為 COM 物件提供與版本無關的 GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 方法之存取權。

GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[])

為 COM 物件提供與版本無關的 GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) 方法之存取權。

GetConstructor(Type[])

為 COM 物件提供與版本無關的 GetConstructor(Type[]) 方法之存取權。

備註

此方法適用于從 Unmanaged 程式碼存取 Managed 類別,不應從 Managed 程式碼呼叫。

方法 Type.GetConstructor 會取得目前 Type 的特定建構函式。

GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

為 COM 物件提供與版本無關的 GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 方法之存取權。

public:
 System::Reflection::ConstructorInfo ^ GetConstructor(System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, System::Reflection::CallingConventions callConvention, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
public System.Reflection.ConstructorInfo GetConstructor (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member GetConstructor : System.Reflection.BindingFlags * System.Reflection.Binder * System.Reflection.CallingConventions * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.ConstructorInfo
Public Function GetConstructor (bindingAttr As BindingFlags, binder As Binder, callConvention As CallingConventions, types As Type(), modifiers As ParameterModifier()) As ConstructorInfo

參數

bindingAttr
BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。

-或-

零,傳回 null

binder
Binder

Binder 物件,定義一組屬性並啟用繫結,可包含多載方法的選擇、引數類型的強制型轉,以及透過反映的成員引動過程。

-或-

null,則使用 DefaultBinder

callConvention
CallingConventions

CallingConventions 物件,其指定一組所要使用的規則,而這些規則是關於引數的順序和配置、如何傳遞傳回值、引數使用哪些暫存器以及清除堆疊。

types
Type[]

Type 物件的陣列,代表所要取得之建構函式的參數數目、順序和類型。

-或-

用以取得沒有參數的建構函式之 Type 類型的空陣列 (也就是,Type[] types = new Type[0])。

modifiers
ParameterModifier[]

ParameterModifier 物件的陣列,代表在 types 陣列中與對應項目關聯的屬性。 預設的繫結器不會處理這個參數。

傳回

ConstructorInfo 物件,代表符合指定之需求的建構函式 (如有找到);否則為 null

備註

此方法適用于從 Unmanaged 程式碼存取 Managed 類別,不應從 Managed 程式碼呼叫。

方法 Type.GetConstructor 會使用指定的系結條件約束和指定的呼叫慣例,搜尋其參數符合指定引數類型和修飾詞的建構函式。

適用於

GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[])

為 COM 物件提供與版本無關的 GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) 方法之存取權。

public:
 System::Reflection::ConstructorInfo ^ GetConstructor(System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
public System.Reflection.ConstructorInfo GetConstructor (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member GetConstructor : System.Reflection.BindingFlags * System.Reflection.Binder * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.ConstructorInfo
Public Function GetConstructor (bindingAttr As BindingFlags, binder As Binder, types As Type(), modifiers As ParameterModifier()) As ConstructorInfo

參數

bindingAttr
BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。

-或-

零,傳回 null

binder
Binder

Binder 物件,定義一組屬性並啟用繫結,可包含多載方法的選擇、引數類型的強制型轉,以及透過反映的成員引動過程。

-或-

null,則使用 DefaultBinder

types
Type[]

Type 物件的陣列,代表所要取得之建構函式的參數數目、順序和類型。

-或-

用以取得沒有參數的建構函式之 Type 類型的空陣列 (也就是,Type[] types = new Type[0])。

-或-

EmptyTypes.

modifiers
ParameterModifier[]

ParameterModifier 物件的陣列,代表在參數類型陣列中與對應項目關聯的屬性。 預設的繫結器不會處理這個參數。

傳回

ConstructorInfo 物件,代表符合指定之需求的建構函式 (如有找到);否則為 null

備註

此方法適用于從 Unmanaged 程式碼存取 Managed 類別,不應從 Managed 程式碼呼叫。

方法會 Type.GetConstructor 使用指定的系結條件約束,搜尋參數符合指定引數類型和修飾詞的建構函式。

適用於

GetConstructor(Type[])

為 COM 物件提供與版本無關的 GetConstructor(Type[]) 方法之存取權。

public:
 System::Reflection::ConstructorInfo ^ GetConstructor(cli::array <Type ^> ^ types);
public System.Reflection.ConstructorInfo GetConstructor (Type[] types);
abstract member GetConstructor : Type[] -> System.Reflection.ConstructorInfo
Public Function GetConstructor (types As Type()) As ConstructorInfo

參數

types
Type[]

Type 物件組成的陣列,表示所要建構函式參數的數目、順序和類型。

-或-

Type 物件組成的空陣列,用來取得不需任何參數的建構函式。 這種供陣列是由 static 欄位 EmptyTypes 提供的。

傳回

ConstructorInfo 物件,表示其參數符合參數類型陣列中之類型的公用執行個體建構函式 (如有找到);否則為 null

備註

此方法適用于從 Unmanaged 程式碼存取 Managed 類別,不應從 Managed 程式碼呼叫。

方法 Type.GetConstructor 會搜尋公用實例建構函式,其參數符合指定陣列中的類型。

適用於