PropertyBuilder.SetValue Method
Definition
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.
Sets the property value for the given object to the given value.
Overloads
SetValue(Object, Object, Object[]) |
Sets the value of the property with optional index values for index properties. |
SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo) |
Sets the property value for the given object to the given value. |
SetValue(Object, Object, Object[])
- Source:
- PropertyBuilder.cs
Sets the value of the property with optional index values for index properties.
public:
override void SetValue(System::Object ^ obj, System::Object ^ value, cli::array <System::Object ^> ^ index);
public override void SetValue (object? obj, object? value, object?[]? index);
public override void SetValue (object obj, object value, object[] index);
override this.SetValue : obj * obj * obj[] -> unit
Public Overrides Sub SetValue (obj As Object, value As Object, index As Object())
Parameters
- obj
- Object
The object whose property value will be set.
- value
- Object
The new value for this property.
- index
- Object[]
Optional index values for indexed properties. This value should be null
for non-indexed properties.
Exceptions
This method is not supported.
Remarks
To set the value of a property, reflect on the property's parent type using Type.GetType or Assembly.GetType, retrieve the PropertyInfo object from the type, and call PropertyInfo.SetValue.
Applies to
SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo)
- Source:
- PropertyBuilder.cs
Sets the property value for the given object to the given value.
public:
override void SetValue(System::Object ^ obj, System::Object ^ value, System::Reflection::BindingFlags invokeAttr, System::Reflection::Binder ^ binder, cli::array <System::Object ^> ^ index, System::Globalization::CultureInfo ^ culture);
public override void SetValue (object? obj, object? value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object?[]? index, System.Globalization.CultureInfo? culture);
public override void SetValue (object obj, object value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] index, System.Globalization.CultureInfo culture);
override this.SetValue : obj * obj * System.Reflection.BindingFlags * System.Reflection.Binder * obj[] * System.Globalization.CultureInfo -> unit
Public Overrides Sub SetValue (obj As Object, value As Object, invokeAttr As BindingFlags, binder As Binder, index As Object(), culture As CultureInfo)
Parameters
- obj
- Object
The object whose property value will be returned.
- value
- Object
The new value for this property.
- 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.
Exceptions
This method is not supported.
Remarks
To set the value of a property, reflect on the property's parent type using Type.GetType or Assembly.GetType, retrieve the PropertyInfo object from the type, and call PropertyInfo.SetValue.