- obj
- The object on which to access the field.
- val
- The value to assign to the field.
- invokeAttr
- A member of IBinder that specifies the type of binding that is desired (for example, IBinder.CreateInstance, IBinder.ExactBinding).
- binder
- A set of properties and enabling for binding, coercion of argument types, and invocation of members using reflection. If binder is null, then IBinder.DefaultBinding is used.
- culture
- The software preferences of a particular culture.
This method will assign the val parameter 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, FieldBuilder.SetValue(object, object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Globalization.CultureInfo) checks to see if the user has access permission.
Access restrictions are ignored for fully-trusted code. Private constructors, methods, fields, and properties can be accessed and invoked using Reflection whenever the code is fully-trusted.
This method is currently not supported. As a workaround, retrieve the System.Reflection.FieldInfo by reflecting on the finished type and call System.Reflection.FieldInfo.SetValue(object, object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Globalization.CultureInfo) to set the value of the field.