System.Reflection.Emit.PropertyBuilder.SetValue Method

Sets the property value for the given object to the given value.

Syntax

public override void SetValue (object obj, object value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] index, System.Globalization.CultureInfo culture)

Parameters

obj
The object whose property value will be returned.
value
The new value for this property.
invokeAttr
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
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
Optional index values for indexed properties. This value should be null for non-indexed properties.
culture
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.

Remarks

To set the value of a property, reflect on the property's parent type using erload:System.Type.GetType or erload:System.Reflection.Assembly.GetType, retrieve the System.Reflection.PropertyInfo object from the type, and call erload:System.Reflection.PropertyInfo.SetValue.

Requirements

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0