Type.GetPropertyImpl(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) Type.GetPropertyImpl(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) Type.GetPropertyImpl(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) Method

定义

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

protected:
 abstract System::Reflection::PropertyInfo ^ GetPropertyImpl(System::String ^ name, System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, Type ^ returnType, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
protected abstract System.Reflection.PropertyInfo GetPropertyImpl (string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Type returnType, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member GetPropertyImpl : string * System.Reflection.BindingFlags * System.Reflection.Binder * Type * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.PropertyInfo

参数

name
String String String

包含要获取的属性名的字符串。The string containing the name of the property to get.

bindingAttr
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 Binder

一个对象,该对象定义一组属性并启用绑定,而绑定可能涉及选择重载成员、强制自变量类型和通过反射调用成员。An object that defines a set of properties and enables binding, which can involve selection of an overloaded member, 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.

returnType
Type Type Type

属性的返回类型。The return type of the property.

types
Type[]

一个 Type 对象数组,表示要获取的索引属性的参数的数目、顺序和类型。An array of Type objects representing the number, order, and type of the parameters for the indexed property 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 property that is not indexed.

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.

返回

表示符合指定要求的属性的对象(如果找到的话);否则为 nullAn object representing the property that matches the specified requirements, if found; otherwise, null.

异常

找到多个具有指定名称的属性且属性与指定绑定约束匹配。More than one property is found with the specified name and matching the specified binding constraints.

namenullname is null.

-or- 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.

以下BindingFlags的筛选器标志可以用于定义要在搜索中包括的属性:The following BindingFlags filter flags can be used to define which properties 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 properties in the search.

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

  • 指定BindingFlags.FlattenHierarchy用以publicprotected层次结构; 上的静态成员private中继承的类的静态成员不包括。Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

以下BindingFlags修饰符标志可以用于更改搜索的工作原理:The following BindingFlags modifier flags can be used to change how the search works:

  • BindingFlags.IgnoreCase 若要忽略大小写的nameBindingFlags.IgnoreCase to ignore the case of name.

  • BindingFlags.DeclaredOnly 若要搜索上声明属性Type,不只是继承的属性。BindingFlags.DeclaredOnly to search only the properties declared on the Type, not properties that were simply inherited.

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

适用于

另请参阅