Method
SetValue
func SetValue(receiver: object?, value: object?) -> Result<void, ReflectionError>
Declaring type: FieldReflectionExtensions
Module: System.Runtime.Reflection
Assembly: System.Runtime.dll
Extension from FieldReflectionExtensions.SetValue
Assigns a public writable instance or static field.
Parameters
| Name | Type | Description |
|---|---|---|
self |
FieldInfo | Runtime-backed field descriptor. |
receiver |
Object? | A compatible non-null object for instance storage; ignored for static storage. |
value |
Object? | Exact boxed scalar or compatible reference/null. |
Return value
Result<void, ReflectionError>
Unit on success or ReflectionError. Private, read-only and literal fields are denied.
Remarks
Nongeneric reference-class instance fields and nominal static fields. Exact boxed built-in scalars or assignable references/null; no coercion, optional defaults, byref/out or custom value payloads. User Faults are terminal. Side effects are not transactional. Imported fields require source access and read-only metadata.