ScriptObject.GetProperty 方法

定义

获取具有指定名称的属性。Gets a property that has a specified name.

重载

GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])

此 API 支持产品基础结构,不能在代码中直接使用。

通过使用指定的选择条件来获取具有指定名称的属性。Gets a property that has the specified name by using the specified selection criteria.

GetProperty(String, BindingFlags)

此 API 支持产品基础结构,不能在代码中直接使用。

获取具有指定名称的属性。Gets a property that has the specified name.

GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])

通过使用指定的选择条件来获取具有指定名称的属性。Gets a property that has the specified name by using the specified selection criteria.

此 API 支持产品基础结构,不能在代码中直接使用。

public:
 virtual System::Reflection::PropertyInfo ^ GetProperty(System::String ^ name, System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, Type ^ returnType, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
public System.Reflection.PropertyInfo GetProperty (string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Type returnType, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member GetProperty : string * System.Reflection.BindingFlags * System.Reflection.Binder * Type * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.PropertyInfo
override this.GetProperty : string * System.Reflection.BindingFlags * System.Reflection.Binder * Type * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.PropertyInfo
Public Function GetProperty (name As String, bindingAttr As BindingFlags, binder As Binder, returnType As Type, types As Type(), modifiers As ParameterModifier()) As PropertyInfo

参数

name
String

要搜索的属性的名称。The name of the property to search for.

bindingAttr
BindingFlags

枚举值的按位组合,用于指定反射如何执行成员搜索。A bitwise combination of the enumeration values that specifies how the search for members is conducted by reflection.

binder
Binder

一个对象,该对象执行从实参类型到形参类型的类型转换。An object that performs type conversion from actual argument type to formal argument type.

returnType
Type

该属性必须具有的返回值的类型。The type of the return value that the property must have.

types
Type[]

所搜索的属性的索引类型。The index types of the property being searched for. 用于索引属性,如类的索引器。Used for index properties, such as the indexer for a class.

modifiers
ParameterModifier[]

使绑定能够处理在其中修改了类型的参数签名的参数修饰符数组。An array of parameter modifiers that enable binding to work with parameter signatures in which the types have been modified.

返回

PropertyInfo

一个具有指定 name 的属性,若脚本对象不包含该属性,则为 null。A property that has the specified name, or null if the script object does not contain the property.

实现

另请参阅

适用于

GetProperty(String, BindingFlags)

获取具有指定名称的属性。Gets a property that has the specified name.

此 API 支持产品基础结构,不能在代码中直接使用。

public:
 virtual System::Reflection::PropertyInfo ^ GetProperty(System::String ^ name, System::Reflection::BindingFlags bindingAttr);
public System.Reflection.PropertyInfo GetProperty (string name, System.Reflection.BindingFlags bindingAttr);
abstract member GetProperty : string * System.Reflection.BindingFlags -> System.Reflection.PropertyInfo
override this.GetProperty : string * System.Reflection.BindingFlags -> System.Reflection.PropertyInfo
Public Function GetProperty (name As String, bindingAttr As BindingFlags) As PropertyInfo

参数

name
String

要获取的属性的名称。The name of the property to get.

bindingAttr
BindingFlags

枚举值的按位组合,用于指定反射如何执行成员搜索。A bitwise combination of the enumeration values that specifies how the search for members is conducted by reflection.

返回

PropertyInfo

一个具有指定 name 的属性,若脚本对象不包含该属性,则为 null。A property that has the specified name, or null if the script object does not contain the property.

实现

另请参阅

适用于