_Type.GetConstructor _Type.GetConstructor _Type.GetConstructor _Type.GetConstructor Method

定義

為 COM 物件提供與版本無關的 GetConstructor 方法之存取權。Provides COM objects with version-independent access to the GetConstructor method.

多載

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

為 COM 物件提供與版本無關的 GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) method.

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

為 COM 物件提供與版本無關的 GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) method.

GetConstructor(Type[]) GetConstructor(Type[]) GetConstructor(Type[]) GetConstructor(Type[])

為 COM 物件提供與版本無關的 GetConstructor(Type[]) 方法之存取權。Provides COM objects with version-independent access to the GetConstructor(Type[]) method.

備註

這個方法會從 unmanaged 程式碼,是用於存取 managed 類別,並不會呼叫從 managed 程式碼。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetConstructor方法會取得目前的特定建構函式TypeThe Type.GetConstructor method gets a specific constructor of the current Type.

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

為 COM 物件提供與版本無關的 GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) method.

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

參數

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-或--or- 零,傳回 nullZero, to return null.

binder
Binder Binder Binder Binder

Binder 物件,定義一組屬性並啟用繫結,可包含多載方法的選擇、引數類型的強制型轉,以及透過反映的成員引動過程。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

-或--or- null,則使用 DefaultBindernull, to use the DefaultBinder.

callConvention
CallingConventions CallingConventions CallingConventions CallingConventions

CallingConventions 物件,其指定一組所要使用的規則,而這些規則是關於引數的順序和配置、如何傳遞傳回值、引數使用哪些暫存器以及清除堆疊。The CallingConventions object that specifies the set of rules to use regarding the order and layout of arguments, how the return value is passed, what registers are used for arguments, and the stack is cleaned up.

types
Type[]

Type 物件的陣列,代表所要取得之建構函式的參數數目、順序和類型。An array of Type objects representing the number, order, and type of the parameters for the constructor to get.

-或--or- 用以取得沒有參數的建構函式之 Type 類型的空陣列 (也就是,Type[] types = new Type[0])。An empty array of the type Type (that is, Type[] types = new Type[0]) to get a constructor that takes no parameters.

modifiers
ParameterModifier[]

ParameterModifier 物件的陣列,代表在 types 陣列中與對應項目關聯的屬性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the types array. 預設的繫結器不會處理這個參數。The default binder does not process this parameter.

傳回

ConstructorInfo 物件,代表符合指定之需求的建構函式 (如有找到);否則為 nullA ConstructorInfo object representing the constructor that matches the specified requirements, if found; otherwise, null.

備註

這個方法會從 unmanaged 程式碼,是用於存取 managed 類別,並不會呼叫從 managed 程式碼。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetConstructor方法會搜尋其參數符合指定引數類型和修飾詞,使用指定的繫結條件約束和指定的呼叫慣例的建構函式。The Type.GetConstructor method searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

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

為 COM 物件提供與版本無關的 GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) method.

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

參數

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-或--or- 零,傳回 nullZero, to return null.

binder
Binder Binder Binder Binder

Binder 物件,定義一組屬性並啟用繫結,可包含多載方法的選擇、引數類型的強制型轉,以及透過反映的成員引動過程。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

-或--or- null,則使用 DefaultBindernull, to use the DefaultBinder.

types
Type[]

Type 物件的陣列,代表所要取得之建構函式的參數數目、順序和類型。An array of Type objects representing the number, order, and type of the parameters for the constructor to get.

-或--or- 用以取得沒有參數的建構函式之 Type 類型的空陣列 (也就是,Type[] types = new Type[0])。An empty array of the type Type (that is, Type[] types = new Type[0]) to get a constructor that takes no parameters.

-或--or- EmptyTypes.EmptyTypes.

modifiers
ParameterModifier[]

ParameterModifier 物件的陣列,代表在參數類型陣列中與對應項目關聯的屬性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the parameter type array. 預設的繫結器不會處理這個參數。The default binder does not process this parameter.

傳回

ConstructorInfo 物件,代表符合指定之需求的建構函式 (如有找到);否則為 nullA ConstructorInfo object representing the constructor that matches the specified requirements, if found; otherwise, null.

備註

這個方法會從 unmanaged 程式碼,是用於存取 managed 類別,並不會呼叫從 managed 程式碼。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetConstructor方法會搜尋其參數符合指定引數類型和修飾詞,使用指定的繫結條件約束的建構函式。The Type.GetConstructor method searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetConstructor(Type[]) GetConstructor(Type[]) GetConstructor(Type[]) GetConstructor(Type[])

為 COM 物件提供與版本無關的 GetConstructor(Type[]) 方法之存取權。Provides COM objects with version-independent access to the GetConstructor(Type[]) method.

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 物件組成的陣列,表示所要建構函式參數的數目、順序和類型。An array of Type objects representing the number, order, and type of the parameters for the desired constructor.

-或--or- Type 物件組成的空陣列,用來取得不需任何參數的建構函式。An empty array of Type objects, to get a constructor that takes no parameters. 這種供陣列是由 static 欄位 EmptyTypes 提供的。Such an empty array is provided by the static field EmptyTypes.

傳回

ConstructorInfo 物件,表示其參數符合參數類型陣列中之類型的公用執行個體建構函式 (如有找到);否則為 nullA ConstructorInfo object representing the public instance constructor whose parameters match the types in the parameter type array, if found; otherwise, null.

備註

這個方法會從 unmanaged 程式碼,是用於存取 managed 類別,並不會呼叫從 managed 程式碼。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetConstructor方法會搜尋其參數符合指定的陣列中之類型的公用執行個體建構函式。The Type.GetConstructor method searches for a public instance constructor whose parameters match the types in the specified array.

適用於