Share via


SetValue Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Sets the value of the field supported by the given object.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overridable Sub SetValue ( _
    obj As Object, _
    value As Object _
)
public virtual void SetValue(
    Object obj,
    Object value
)
public:
virtual void SetValue(
    Object^ obj, 
    Object^ value
)
abstract SetValue : 
        obj:Object * 
        value:Object -> unit 
override SetValue : 
        obj:Object * 
        value:Object -> unit 
public function SetValue(
    obj : Object, 
    value : Object
)

Parameters

Remarks

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 an Object. For example, if the field's type is Boolean, an instance of Object 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.

.NET Framework Security

See Also

Reference

FieldInfo Class

System.Reflection Namespace