Sets the value of the field supported by the given object.
[Visual Basic] Overloads Public Sub SetValue( _ ByVal obj As Object, _ ByVal value As Object _ ) [C#] public void SetValue( object obj, object value ); [C++] public: void SetValue( Object* obj, Object* value ); [JScript] public function SetValue( obj : Object, value : Object );
This method will assign value to the field reflected by this instance on object obj. If the field is static, obj will be ignored. For non-static fields, obj should be an instance of a class that inherits or declares the field. The new value is passed as a Variant. For example, if the field's type is Boolean, an instance of Variant with the appropriate Boolean value is passed. Before setting the value, SetValue checks to see if the user has access permission. This final method is a convenience method for calling the following SetValue method.
Note Access restrictions are ignored for fully trusted code. That is, private constructors, methods, fields, and properties can be accessed and invoked via Reflection whenever the code is fully trusted.
FieldInfo Class | FieldInfo Members | System.Reflection Namespace | FieldInfo.SetValue Overload List