Module FieldAttributes
Expand description
Field attribute constants for controlling field characteristics and behavior
This module provides constants for the FieldAttributes bitmask that controls
various aspects of field behavior including access control, storage type,
mutability, and special runtime characteristics. These attributes are defined
in the ECMA-335 specification and control how the runtime handles field access
and storage.
§Attribute Categories
§Access Control (3-bit mask)
Controls visibility and accessibility of the field from different contexts.
§Storage Type
Determines whether the field is per-instance or shared across all instances.
§Mutability
Controls when and how the field value can be modified.
§Special Characteristics
Provides additional runtime behavior and metadata information.
§Reference
- ECMA-335 II.23.1.5 -
FieldAttributesspecification
Constants§
- ASSEMBLY
- Field accessible by anyone within the assembly
- COMPILER_
CONTROLLED - Field not referenceable by user code
- FAMILY
- Field accessible only by type and subtypes
- FAM_
AND_ ASSEM - Field accessible by subtypes only within this assembly
- FAM_
OR_ ASSEM - Field accessible by subtypes anywhere, plus anyone in assembly
- FIELD_
ACCESS_ MASK - Mask for extracting access control bits from field attributes
- HAS_
DEFAULT - Field has a default value
- HAS_
FIELD_ MARSHAL - Field has associated marshaling information
- HAS_
FIELD_ RVA - Field has associated RVA (Relative Virtual Address)
- INIT_
ONLY - Field can only be initialized, not written after initialization
- LITERAL
- Field value is a compile-time constant
- NOT_
SERIALIZED - Field should not be serialized when type is remoted
- PINVOKE_
IMPL - Implementation is forwarded through P/Invoke
- PRIVATE
- Field accessible only by the parent type
- PUBLIC
- Field accessible by anyone who has visibility to this scope
- RTSPECIAL_
NAME - CLI provides special behavior depending on the field name
- SPECIAL_
NAME - Field has special name significance
- STATIC
- Field is defined on type rather than per instance