Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Method

GetValue

func GetValue(receiver: object?) -> Result<object?, ReflectionError>

Declaring type: FieldReflectionExtensions
Module: System.Runtime.Reflection
Assembly: System.Runtime.dll

Extension from FieldReflectionExtensions.GetValue

Reads a public instance or static field, or a literal.

Parameters

Name Type Description
self FieldInfo Runtime-backed field descriptor.
receiver Object? A compatible non-null object for instance storage; ignored for static storage and literals.

Return value

Result<Object?, ReflectionError>

Its boxed/reference value or ReflectionError.

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 metadata.