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

C#
public System.Reflection.PropertyInfo GetProperty(string name, Type returnType, Type[] types, System.Reflection.ParameterModifier[] modifiers);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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

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

C#
public System.Reflection.PropertyInfo GetProperty(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Type returnType, Type[] types, System.Reflection.ParameterModifier[] modifiers);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

GetProperty(String, Type, Type[])

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

C#
public System.Reflection.PropertyInfo GetProperty(string name, Type returnType, Type[] types);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

GetProperty(String, Type)

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

C#
public System.Reflection.PropertyInfo GetProperty(string name, Type returnType);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

GetProperty(String, Type[])

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

C#
public System.Reflection.PropertyInfo GetProperty(string name, Type[] types);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

GetProperty(String, BindingFlags)

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

C#
public System.Reflection.PropertyInfo GetProperty(string name, System.Reflection.BindingFlags bindingAttr);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

GetProperty(String)

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

C#
public System.Reflection.PropertyInfo GetProperty(string name);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1