Type.GetConstructorImpl(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) Type.GetConstructorImpl(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) Type.GetConstructorImpl(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) Method


当在派生类中重写时,使用指定的绑定约束和指定的调用约定搜索其参数与指定的自变量类型和修饰符匹配的构造函数。When overridden in a derived class, searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

 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


BindingFlags BindingFlags BindingFlags

枚举值的按位组合,这些值指定如何进行搜索。A bitwise combination of the enumeration values that specify how the search is conducted.

- 或 --or- 若为 Default,则返回 nullDefault to return null.

Binder Binder Binder

一个对象,该对象定义一组属性并启用绑定,而绑定可能涉及选择重载方法、强制参数类型和通过反射调用成员。An 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- 要使用 Nothing 的空引用(在 Visual Basic 中为 DefaultBinder)。A null reference (Nothing in Visual Basic), to use the DefaultBinder.

CallingConventions CallingConventions CallingConventions

对象,用于指定要使用的一套规则,这些规则涉及参数的顺序和布局、传递返回值的方式、用于参数的寄存器和清理堆栈的方式。The 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.


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.


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.


typesnulltypes is null.

- 或 --or- types 的其中一个元素为 nullOne of the elements in types is null.

types 是多维的。types is multidimensional.

- 或 --or- modifiers 是多维的。modifiers is multidimensional.

- 或 --or- typesmodifiers 的长度不相同。types and modifiers do not have the same length.


尽管默认联编程序不会处理ParameterModifier(modifiers参数),您可以使用抽象System.Reflection.Binder类以编写的自定义联编程序modifiersAlthough the default binder does not process ParameterModifier (the modifiers parameter), you can use the abstract System.Reflection.Binder class to write a custom binder that does process modifiers. ParameterModifier 通过 COM 互操作调用时,才使用和处理由引用传递的参数。ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

完全匹配项不存在,如果binder将尝试强制转换中指定的参数类型types才能选择匹配项的数组。If an exact match does not exist, the binder will attempt to coerce the parameter types specified in the types array in order to select a match. 如果binder无法选择匹配项,然后null返回。If the binder is unable to select a match, then null is returned.

以下BindingFlags的筛选器标志可用于定义要包括在搜索中的构造函数:The following BindingFlags filter flags can be used to define which constructors to include in the search:

  • 您必须指定这两BindingFlags.InstanceBindingFlags.Static为了获取返回。You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  • 指定BindingFlags.Public若要在搜索中包括公共构造函数。Specify BindingFlags.Public to include public constructors in the search.

  • 指定BindingFlags.NonPublic若要在搜索中包括非公共构造函数 (即私有、 内部和受保护的构造函数)。Specify BindingFlags.NonPublic to include non-public constructors (that is, private, internal, and protected constructors) in the search.

有关更多信息,请参见System.Reflection.BindingFlagsSee System.Reflection.BindingFlags for more information.

此方法实现 GetConstructorThis method implements GetConstructor.