PropertyBuilder.GetValue Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the value of the property by calling the getter.
GetValue(Object, Object[]) |
Gets the value of the indexed property by calling the property's getter method. |
GetValue(Object, BindingFlags, Binder, Object[], CultureInfo) |
Gets the value of a property having the specified binding, index, and |
- Source:
- PropertyBuilder.cs
Gets the value of the indexed property by calling the property's getter method.
public:
override System::Object ^ GetValue(System::Object ^ obj, cli::array <System::Object ^> ^ index);
public override object GetValue (object? obj, object?[]? index);
public override object GetValue (object obj, object[] index);
override this.GetValue : obj * obj[] -> obj
Public Overrides Function GetValue (obj As Object, index As Object()) As Object
Parameters
- obj
- Object
The object whose property value will be returned.
- index
- Object[]
Optional index values for indexed properties. This value should be null
for non-indexed properties.
Returns
The value of the specified indexed property.
Exceptions
This method is not supported.
Remarks
To get the value of a property, reflect on the property's parent type using Type.GetType or Assembly.GetType, retrieve the Reflection
property object from the type, and call PropertyInfo.GetValue
.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.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 |
.NET Standard | 2.0 (package-provided), 2.1 |
- Source:
- PropertyBuilder.cs
Gets the value of a property having the specified binding, index, and CultureInfo
.
public:
override System::Object ^ GetValue(System::Object ^ obj, System::Reflection::BindingFlags invokeAttr, System::Reflection::Binder ^ binder, cli::array <System::Object ^> ^ index, System::Globalization::CultureInfo ^ culture);
public override object GetValue (object? obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object?[]? index, System.Globalization.CultureInfo? culture);
public override object GetValue (object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] index, System.Globalization.CultureInfo culture);
override this.GetValue : obj * System.Reflection.BindingFlags * System.Reflection.Binder * obj[] * System.Globalization.CultureInfo -> obj
Public Overrides Function GetValue (obj As Object, invokeAttr As BindingFlags, binder As Binder, index As Object(), culture As CultureInfo) As Object
Parameters
- obj
- Object
The object whose property value will be returned.
- invokeAttr
- BindingFlags
The invocation attribute. This must be a bit flag from BindingFlags
: InvokeMethod
, CreateInstance
, Static
, GetField
, SetField
, GetProperty
, or SetProperty
. A suitable invocation attribute must be specified. If a static member is to be invoked, the Static
flag of BindingFlags
must be set.
- binder
- Binder
An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo
objects using reflection. If binder
is null
, the default binder is used.
- index
- Object[]
Optional index values for indexed properties. This value should be null
for non-indexed properties.
- culture
- CultureInfo
The CultureInfo
object that represents the culture for which the resource is to be localized. Note that if the resource is not localized for this culture, the CultureInfo.Parent
method will be called successively in search of a match. If this value is null
, the CultureInfo
is obtained from the CultureInfo.CurrentUICulture
property.
Returns
The property value for obj
.
Exceptions
This method is not supported.
Remarks
To get the value of a property, reflect on the property's parent type using Type.GetType or Assembly.GetType, retrieve the Reflection property object from the type, and call PropertyInfo.GetValue.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.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 |
.NET Standard | 2.0 (package-provided), 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: