แก้ไข

แชร์ผ่าน


_Type.GetProperty Method

Definition

Provides COM objects with version-independent access to the GetProperty method.

Overloads

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

Provides COM objects with version-independent access to the GetProperty(String, Type, Type[], ParameterModifier[]) method.

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

Provides COM objects with version-independent access to the GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) method.

GetProperty(String, Type, Type[])

Provides COM objects with version-independent access to the GetProperty(String, Type, Type[]) method.

GetProperty(String, Type)

Provides COM objects with version-independent access to the GetProperty(String, Type) method.

GetProperty(String, Type[])

Provides COM objects with version-independent access to the GetProperty(String, Type[]) method.

GetProperty(String, BindingFlags)

Provides COM objects with version-independent access to the GetProperty(String, BindingFlags) method.

GetProperty(String)

Provides COM objects with version-independent access to the GetProperty(String) method.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetProperty method gets a specific property of the current Type.

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

Provides COM objects with version-independent access to the GetProperty(String, Type, Type[], ParameterModifier[]) method.

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

Parameters

name
String

The String containing the name of the public property to get.

returnType
Type

The return type of the property.

types
Type[]

An array of Type objects representing the number, order, and type of the parameters for the indexed property to get.

-or-

An empty array of the type Type (that is, Type[] types = new Type[0]) to get a property that is not indexed.

modifiers
ParameterModifier[]

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.

Returns

A PropertyInfo object representing the public property that matches the specified requirements, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetProperty method searches for the specified public property whose parameters match the specified argument types and modifiers.

Applies to

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

Provides COM objects with version-independent access to the GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) method.

public:
 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
Public Function GetProperty (name As String, bindingAttr As BindingFlags, binder As Binder, returnType As Type, types As Type(), modifiers As ParameterModifier()) As PropertyInfo

Parameters

name
String

The String containing the name of the property to get.

bindingAttr
BindingFlags

A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-or-

Zero, to return null.

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, to use the DefaultBinder.

returnType
Type

The return type of the property.

types
Type[]

An array of Type objects representing the number, order, and type of the parameters for the indexed property to get.

-or-

An empty array of the type Type (that is, Type[] types = new Type[0]) to get a property that is not indexed.

modifiers
ParameterModifier[]

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.

Returns

A PropertyInfo object representing the property that matches the specified requirements, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetProperty method searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.

Applies to

GetProperty(String, Type, Type[])

Provides COM objects with version-independent access to the GetProperty(String, Type, Type[]) method.

public:
 System::Reflection::PropertyInfo ^ GetProperty(System::String ^ name, Type ^ returnType, cli::array <Type ^> ^ types);
public System.Reflection.PropertyInfo GetProperty (string name, Type returnType, Type[] types);
abstract member GetProperty : string * Type * Type[] -> System.Reflection.PropertyInfo
Public Function GetProperty (name As String, returnType As Type, types As Type()) As PropertyInfo

Parameters

name
String

The String containing the name of the public property to get.

returnType
Type

The return type of the property.

types
Type[]

An array of Type objects representing the number, order, and type of the parameters for the indexed property to get.

-or-

An empty array of the type Type (that is, Type[] types = new Type[0]) to get a property that is not indexed.

Returns

A PropertyInfo object representing the public property whose parameters match the specified argument types, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetProperty method searches for the specified public property whose parameters match the specified argument types.

Applies to

GetProperty(String, Type)

Provides COM objects with version-independent access to the GetProperty(String, Type) method.

public:
 System::Reflection::PropertyInfo ^ GetProperty(System::String ^ name, Type ^ returnType);
public System.Reflection.PropertyInfo GetProperty (string name, Type returnType);
abstract member GetProperty : string * Type -> System.Reflection.PropertyInfo
Public Function GetProperty (name As String, returnType As Type) As PropertyInfo

Parameters

name
String

The String containing the name of the public property to get.

returnType
Type

The return type of the property.

Returns

A PropertyInfo object representing the public property with the specified name, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetProperty method searches for the public property with the specified name and return type.

Applies to

GetProperty(String, Type[])

Provides COM objects with version-independent access to the GetProperty(String, Type[]) method.

public:
 System::Reflection::PropertyInfo ^ GetProperty(System::String ^ name, cli::array <Type ^> ^ types);
public System.Reflection.PropertyInfo GetProperty (string name, Type[] types);
abstract member GetProperty : string * Type[] -> System.Reflection.PropertyInfo
Public Function GetProperty (name As String, types As Type()) As PropertyInfo

Parameters

name
String

The String containing the name of the public property to get.

types
Type[]

An array of Type objects representing the number, order, and type of the parameters for the indexed property to get.

-or-

An empty array of the type Type (that is, Type[] types = new Type[0]) to get a property that is not indexed.

Returns

A PropertyInfo object representing the public property whose parameters match the specified argument types, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetProperty method searches for the specified public property whose parameters match the specified argument types.

Applies to

GetProperty(String, BindingFlags)

Provides COM objects with version-independent access to the GetProperty(String, BindingFlags) method.

public:
 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
Public Function GetProperty (name As String, bindingAttr As BindingFlags) As PropertyInfo

Parameters

name
String

The String containing the name of the property to get.

bindingAttr
BindingFlags

A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-or-

Zero, to return null.

Returns

A PropertyInfo object representing the property that matches the specified requirements, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetProperty method searches for the specified property, using the specified binding constraints.

Applies to

GetProperty(String)

Provides COM objects with version-independent access to the GetProperty(String) method.

public:
 System::Reflection::PropertyInfo ^ GetProperty(System::String ^ name);
public System.Reflection.PropertyInfo GetProperty (string name);
abstract member GetProperty : string -> System.Reflection.PropertyInfo
Public Function GetProperty (name As String) As PropertyInfo

Parameters

name
String

The String containing the name of the public property to get.

Returns

A PropertyInfo object representing the public property with the specified name, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetProperty method searches for the public property with the specified name.

Applies to