Type.GetConstructorImpl 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當在衍生類別中被覆寫時,會搜尋參數與指定參數類型與修飾符相符的建構子,使用指定的綁定約束與指定的呼叫慣例。
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);
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
參數
- binder
- Binder
一個定義一組屬性並啟用綁定的物件,綁定可能涉及選擇超載方法、強制參數類型,以及透過反射呼叫成員。
-或-
一個空參考(Nothing in Visual Basic),用來使用 DefaultBinder。
- callConvention
- CallingConventions
指定參數順序與佈局、回傳值傳遞方式、參數使用暫存器及堆疊整理的規則集合。
- modifiers
- ParameterModifier[]
一個代表陣列中對應元素ParameterModifier屬性的物件陣列types。 預設的綁定器不會處理這個參數。
傳回
ConstructorInfo若找到符合指定需求的建構子物件;否則,為 null。
例外狀況
備註
雖然預設系結器不會處理 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。