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

API Browser

Interface

FieldInfo

sealed interface FieldInfo

Module: System.Introspection
Assembly: System.Runtime.dll
Source file: Descriptors.rvn

Inherits: MemberInfo
Closed hierarchy: only the permitted direct subtypes can extend this type.
Permitted direct subtypes: RuntimeFieldInfo
Part of closed hierarchy: MemberInfo

Describes a retained field declaration in the loaded program.

Remarks

Development after Preview 9. Object equality uses descriptor kind, closed declaring type and definition index. Repeated wrappers can compare equal; Object hashes agree and ToString returns Name, not a complete signature. This API describes metadata and does not invoke, read or write application members. See the introspection guide for query and identity limitations.

Properties

13 items
ConstantValue: Optional<object> The declared constant, without executing initialization; None for storage fields. Defined by FieldInfo.ConstantValue · Required implementation (no default).
DeclaringType: Optional<TypeInfo> Gets the declaring type, or None for a top-level member. Inherited from MemberInfo.DeclaringType · Defined by MemberInfo.DeclaringType · Required implementation (no default).
DefinitionIndex: int Gets the runtime definition index. This is not a metadata token or persistent ID; interpret it with the member kind and declaring type. Defined by FieldInfo.DefinitionIndex · Required implementation (no default).
FieldType: TypeInfo Gets the field type with declaring-type generic arguments substituted. Defined by FieldInfo.FieldType · Required implementation (no default).
IsAssembly: bool Reports internal (assembly) visibility. Defined by FieldInfo.IsAssembly · Required implementation (no default).
IsInitOnly: bool True for storage assignable only during its owning initialization. Defined by FieldInfo.IsInitOnly · Required implementation (no default).
IsLiteral: bool True for a storage-free constant declaration. Defined by FieldInfo.IsLiteral · Required implementation (no default).
IsPrivate: bool Reports private visibility. Defined by FieldInfo.IsPrivate · Required implementation (no default).
IsPublic: bool Reports public visibility. Defined by FieldInfo.IsPublic · Required implementation (no default).
IsStatic: bool Reports whether the field is static, including storage-free literal declarations. Defined by FieldInfo.IsStatic · Required implementation (no default).
MetadataToken: Optional<int> Gets Some(token) for available declaration metadata, or None for a synthesized member. Tokens are scoped to their defining module. Inherited from MemberInfo.MetadataToken · Defined by MemberInfo.MetadataToken · Required implementation (no default).
Module: Optional<ModuleInfo> Gets Some(module) for a declared member, or None when no defining module exists. Inherited from MemberInfo.Module · Defined by MemberInfo.Module · Required implementation (no default).
Name: string Gets the declared or synthesized member name. Inherited from MemberInfo.Name · Defined by MemberInfo.Name · Required implementation (no default).

Methods

3 items
GetCustomAttributesData() -> Sequence<CustomAttributeData> Gets directly declared retained attribute data without executing attribute constructors. Inherited from MemberInfo.GetCustomAttributesData · Defined by MemberInfo.GetCustomAttributesData · Required implementation (no default).
Extension member: GetValue(receiver: object?) -> Result<object?, ReflectionError> Reads a public instance or static field, or a literal. Extension from FieldReflectionExtensions.GetValue
Extension member: SetValue(receiver: object?, value: object?) -> Result<void, ReflectionError> Assigns a public writable instance or static field. Extension from FieldReflectionExtensions.SetValue