Type.GetConstructorImpl 方法

定義

在衍生類別中覆寫時,使用指定的繫結條件約束和指定的呼叫慣例,搜尋其參數符合指定的引數類型和修飾詞的建構函式。

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

參數

bindingAttr
BindingFlags

列舉值的位元組合,用來指定搜尋的執行方式。

-或- 要傳回 nullDefault

binder
Binder

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

-或- Null 參考 (在 Visual Basic 中為Nothing ),可使用 DefaultBinder

callConvention
CallingConventions

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

types
Type[]

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

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

modifiers
ParameterModifier[]

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

傳回

ConstructorInfo

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

例外狀況

typesnull

-或- types 的其中一個項目為 null

types 是多維的。

-或- modifiers 是多維的。

-或- typesmodifiers 的長度不同。

備註

雖然預設系結器不會處理 ParameterModifier modifiers 參數) (,但您可以使用抽象 System.Reflection.Binder 類來撰寫執行處理常式的自訂 modifiers 系結器。 ParameterModifier 只有在透過 COM interop 呼叫時才會使用,而且只會處理以傳址方式傳遞的參數。

如果完全相符不存在, binder 將會嘗試強制強制執行陣列中指定的參數類型,以便 types 選取相符的。 如果 binder 無法選取相符項,則 null 會傳回。

下列 BindingFlags 篩選旗標可以用來定義要包含在搜尋中的哪些函式:

  • 您必須指定或,才能 BindingFlags.Instance BindingFlags.Static 取得傳回。

  • 指定 BindingFlags.Public 要在搜尋中包含公用的函式。

  • 指定 BindingFlags.NonPublic 要包含非公用的函式 (也就是在搜尋中) 的私用、內部和受保護的函式。

如需相關資訊,請參閱 System.Reflection.BindingFlags

這個方法會實作 GetConstructor

適用於

另請參閱