다음을 통해 공유


Type.GetConstructorImpl 메서드

파생 클래스에서 재정의된 경우, 지정된 인수 형식 및 한정자와 일치하는 매개 변수를 가진 생성자를 지정된 바인딩 제약 조건 및 호출 규칙으로 검색합니다.

네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Protected MustOverride Function GetConstructorImpl ( _
    bindingAttr As BindingFlags, _
    binder As Binder, _
    callConvention As CallingConventions, _
    types As Type(), _
    modifiers As ParameterModifier() _
) As ConstructorInfo
‘사용 방법
Dim bindingAttr As BindingFlags
Dim binder As Binder
Dim callConvention As CallingConventions
Dim types As Type()
Dim modifiers As ParameterModifier()
Dim returnValue As ConstructorInfo

returnValue = Me.GetConstructorImpl(bindingAttr, binder, callConvention, types, modifiers)
protected abstract ConstructorInfo GetConstructorImpl (
    BindingFlags bindingAttr,
    Binder binder,
    CallingConventions callConvention,
    Type[] types,
    ParameterModifier[] modifiers
)
protected:
virtual ConstructorInfo^ GetConstructorImpl (
    BindingFlags bindingAttr, 
    Binder^ binder, 
    CallingConventions callConvention, 
    array<Type^>^ types, 
    array<ParameterModifier>^ modifiers
) abstract
protected abstract ConstructorInfo GetConstructorImpl (
    BindingFlags bindingAttr, 
    Binder binder, 
    CallingConventions callConvention, 
    Type[] types, 
    ParameterModifier[] modifiers
)
protected abstract function GetConstructorImpl (
    bindingAttr : BindingFlags, 
    binder : Binder, 
    callConvention : CallingConventions, 
    types : Type[], 
    modifiers : ParameterModifier[]
) : ConstructorInfo

매개 변수

  • bindingAttr
    검색 방법을 지정하는 하나 이상의 BindingFlags로 구성된 비트 마스크입니다.

    - 또는 -

    0(Null 참조(Visual Basic의 경우 Nothing)를 반환하는 경우)

  • 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의 요소 중 하나가 Null 참조(Visual Basic의 경우 Nothing)인 경우

ArgumentException

types가 다차원 배열인 경우

- 또는 -

modifiers가 다차원 배열인 경우

- 또는 -

types와 modifiers의 길이가 같지 않은 경우

설명

기본 바인더에서 ParameterModifier(modifiers 매개 변수)를 처리하지 않더라도 추상 System.Reflection.Binder 클래스를 사용하여 modifiers를 처리하는 사용자 지정 바인더를 작성할 수 있습니다. ParameterModifier는 COM interop를 통해 호출할 때에만 사용할 수 있으며 참조로 전달된 매개 변수만 처리됩니다.

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을 지정해야 합니다.

  • 검색에 public 생성자를 포함하려면 BindingFlags.Public을 지정합니다.

  • 검색에 public이 아닌 생성자, 즉 private 생성자 및 protected 생성자를 포함하려면 BindingFlags.NonPublic을 지정합니다.

자세한 내용은 System.Reflection.BindingFlags를 참조하십시오.

이 메서드는 GetConstructor를 구현합니다.

요청된 형식이 public 형식이 아니고 public 형식이 아닌 개체를 현재 어셈블리의 외부에 리플렉션할 수 있는 ReflectionPermission이 호출자에게 없는 경우 이 메서드는 Null 참조(Visual Basic의 경우 Nothing)를 반환합니다.

GetConstructorGetConstructorImpl는 클래스 이니셜라이저를 가져오는 데 사용할 수 없습니다. GetMember, GetMembers, FindMembersGetConstructors를 통해서만 클래스 이니셜라이저를 사용할 수 있습니다.

.NET Framework 보안

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

Type 클래스
Type 멤버
System 네임스페이스
ConstructorInfo
BindingFlags
Binder
DefaultBinder
CallingConventions
ParameterModifier
ReflectionPermission
GetConstructor
GetConstructors