_Type.GetConstructor _Type.GetConstructor _Type.GetConstructor _Type.GetConstructor Method

定义

为 COM 对象提供对 GetConstructor 方法的版本无关的访问。Provides COM objects with version-independent access to the GetConstructor method.

重载

GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

为 COM 对象提供对 GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) method.

GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[])

为 COM 对象提供对 GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) method.

GetConstructor(Type[]) GetConstructor(Type[]) GetConstructor(Type[]) GetConstructor(Type[])

为 COM 对象提供对 GetConstructor(Type[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetConstructor(Type[]) method.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetConstructor方法获取当前的特定构造函数TypeThe Type.GetConstructor method gets a specific constructor of the current Type.

GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

为 COM 对象提供对 GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) method.

public:
 System::Reflection::ConstructorInfo ^ GetConstructor(System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, System::Reflection::CallingConventions callConvention, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
public System.Reflection.ConstructorInfo GetConstructor (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member GetConstructor : System.Reflection.BindingFlags * System.Reflection.Binder * System.Reflection.CallingConventions * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.ConstructorInfo

参数

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

- 或 --or- 零,以返回 nullZero, to return null.

binder
Binder Binder Binder Binder

一个 Binder 对象,该对象定义一组属性并启用绑定,而绑定可能涉及选择重载方法、强制转换参数类型和通过反射调用成员。A Binder 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- 若为 null,则使用 DefaultBindernull, to use the DefaultBinder.

callConvention
CallingConventions CallingConventions CallingConventions CallingConventions

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

types
Type[]

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.

modifiers
ParameterModifier[]

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.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetConstructor方法搜索其参数与指定的参数类型及修饰符,使用指定的绑定约束和指定的调用约定匹配的构造函数。The Type.GetConstructor method searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[])

为 COM 对象提供对 GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) method.

public:
 System::Reflection::ConstructorInfo ^ GetConstructor(System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
public System.Reflection.ConstructorInfo GetConstructor (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member GetConstructor : System.Reflection.BindingFlags * System.Reflection.Binder * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.ConstructorInfo

参数

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

- 或 --or- 零,以返回 nullZero, to return null.

binder
Binder Binder Binder Binder

一个 Binder 对象,该对象定义一组属性并启用绑定,而绑定可能涉及选择重载方法、强制转换参数类型和通过反射调用成员。A Binder 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- 若为 null,则使用 DefaultBindernull, to use the DefaultBinder.

types
Type[]

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.

- 或 --or- EmptyTypesEmptyTypes.

modifiers
ParameterModifier[]

ParameterModifier 对象的数组,表示与参数类型数组中的相应元素关联的特性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the parameter type 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.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetConstructor方法搜索其参数与指定的参数类型及修饰符,使用指定的绑定约束匹配的构造函数。The Type.GetConstructor method searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetConstructor(Type[]) GetConstructor(Type[]) GetConstructor(Type[]) GetConstructor(Type[])

为 COM 对象提供对 GetConstructor(Type[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetConstructor(Type[]) method.

public:
 System::Reflection::ConstructorInfo ^ GetConstructor(cli::array <Type ^> ^ types);
public System.Reflection.ConstructorInfo GetConstructor (Type[] types);
abstract member GetConstructor : Type[] -> System.Reflection.ConstructorInfo
Public Function GetConstructor (types As Type()) As ConstructorInfo

参数

types
Type[]

表示需要的构造函数的参数个数、顺序和类型的 Type 对象的数组。An array of Type objects representing the number, order, and type of the parameters for the desired constructor.

-or- Type 对象的空数组,用于获取不带参数的构造函数。An empty array of Type objects, to get a constructor that takes no parameters. 这样的空数组由 static 字段 EmptyTypes 提供。Such an empty array is provided by the static field EmptyTypes.

返回

为表示某个公共实例构造函数(该构造函数的参数与参数类型数组中的类型匹配)的 ConstructorInfo 对象(如果找到的话);否则为 nullA ConstructorInfo object representing the public instance constructor whose parameters match the types in the parameter type array, if found; otherwise, null.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetConstructor方法搜索其参数与指定数组中的类型匹配的公共实例构造函数。The Type.GetConstructor method searches for a public instance constructor whose parameters match the types in the specified array.

适用于