Type.GetConstructorImpl メソッド
派生クラスによってオーバーライドされた場合、指定したバインディング制約および指定した呼び出し規約を使用して、指定した引数の型および修飾子と一致するパラメータが設定されているコンストラクタを検索します。
Protected MustOverride Function GetConstructorImpl( _
ByVal bindingAttr As BindingFlags, _ ByVal binder As Binder, _ ByVal callConvention As CallingConventions, _ ByVal types() As Type, _ ByVal modifiers() As ParameterModifier _) As ConstructorInfo
[C#]
protected abstract ConstructorInfo GetConstructorImpl(BindingFlagsbindingAttr,Binderbinder,CallingConventionscallConvention,Type[] types,ParameterModifier[] modifiers);
[C++]
protected: virtual ConstructorInfo* GetConstructorImpl(BindingFlagsbindingAttr,Binder* binder,CallingConventionscallConvention,Type* types[],ParameterModifiermodifiers[]) = 0;
[JScript]
protected abstract function GetConstructorImpl(
bindingAttr : BindingFlags,binder : Binder,callConvention : CallingConventions,types : Type[],modifiers : ParameterModifier[]) : ConstructorInfo;
パラメータ
bindingAttr
検索の実行方法を指定する 1 つ以上の BindingFlags から成るビット マスク。または
null 参照 (Visual Basic では Nothing) を返す 0。
binder
一連のプロパティを定義し、バインディングを有効にする Binder オブジェクト。バインディングには、オーバーロードされたメソッドの選択、引数の型の強制変換、リフレクションによるメンバの呼び出しなどが含まれます。または
DefaultBinder を使用する場合は null 参照 (Visual Basic では Nothing) 。
callConvention
引数の順序とレイアウト、戻り値を渡す方法、引数を格納するレジスタ、スタックのクリーンアップに関する一連の規則を指定する CallingConventions オブジェクト。types
取得するコンストラクタのパラメータの数、順序、および型を表す Type オブジェクトの配列。または
パラメータをとらないコンストラクタを取得するための、 Type 型の空の配列 (Type[] types = new Type[0])。
modifiers
types 配列内の対応する要素に関連付けられている属性を表す ParameterModifier オブジェクトの配列。既定のバインダは、このパラメータを処理しません。
戻り値
指定した要件と一致するコンストラクタが存在する場合は、そのコンストラクタを表す ConstructorInfo オブジェクト。それ以外の場合は null 参照 (Visual Basic では Nothing) 。
例外
例外の種類 | 条件 |
---|---|
ArgumentNullException | types が null 参照 (Visual Basic では Nothing) です。
または types の 1 つの要素が null 参照 (Nothing) です。 |
ArgumentException | types が多次元です。
または modifiers が多次元です。 または types と modifiers の長さが異なります。 |
解説
既定のバインダは ParameterModifier (modifiers パラメータ) を処理しませんが、 System.Reflection.Binder 抽象クラスを使用して modifiers を処理するカスタム バインダを記述できます。 ParameterModifier は、COM 相互運用機能によって呼び出すときだけに使用され、参照渡しされるパラメータだけが処理されます。
types 配列と modifiers 配列の長さが同じです。types 配列で指定するパラメータには、 modifiers 配列で指定されている pdIn、pdOut、pdLcid、pdRetval、pdOptional、pdHasDefault の各属性を設定できます。これらの属性は、それぞれ [In]、[Out]、[lcid]、[retval]、[optional]、およびパラメータが既定値を持つかどうかを指定する値を表します。パラメータに関連付けられた属性はメタデータに格納され、相互運用性のために使用されます。
厳密に一致する対象が存在しない場合は、一致するものを選択するために、binder は types 配列で指定されたパラメータの型を強制的に変換しようとします。binder が一致するものを選択できない場合は、 null 参照 (Visual Basic では Nothing) が返されます。
次の BindingFlags フィルタ フラグは、検索対象に含めるコンストラクタを定義するために使用できます。
- 戻り値を取得するには、 BindingFlags.Instance または BindingFlags.Static のいずれかを指定する必要があります。
- 検索対象にパブリック コンストラクタを含めるための BindingFlags.Public を指定します。
- 検索対象にパブリックではないコンストラクタ (つまり、プライベート コンストラクタやプロテクト コンストラクタ) を含めるための BindingFlags.NonPublic を指定します。
詳細については、「 System.Reflection.BindingFlags 」を参照してください。
このメソッドは、 GetConstructor を実装します。
要求された型がパブリックではなく、呼び出し元に現在のアセンブリ外の非パブリック オブジェクトをリフレクションするための ReflectionPermission がない場合、このメソッドは null 参照 (Nothing) を返します。
GetConstructor および GetConstructorImpl は、クラス初期化子を取得するためには使用できません。クラス初期化子は、 GetMember 、 GetMembers 、 FindMembers 、および GetConstructors を通じてだけ使用できます。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
.NET Framework セキュリティ:
- ReflectionPermission (非パブリック オブジェクトをリフレクション操作するために必要なアクセス許可) ReflectionPermissionFlag.TypeInformation (関連する列挙体)
参照
Type クラス | Type メンバ | System 名前空間 | ConstructorInfo | BindingFlags | Binder | DefaultBinder | CallingConventions | ParameterModifier | ReflectionPermission | GetConstructor | GetConstructors