System.Reflection.FieldAttributes Enumeration

Specifies flags that describe the attributes of a field.

Syntax

[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
public enum FieldAttributes

Remarks

FieldAttributes uses the value from FieldAccessMask to mask off only the parts of the attribute value that pertain to the accessibility. For example, the following code determines if Attributes has the public bit set.

code reference: System.Reflection.FieldAttributes#1

To get the FieldAttributes, first get the class Type. From the Type, get the FieldInfo. From the FieldInfo, get the Attributes.

The enumerated value is a number representing the bitwise OR of the attributes implemented on the field.

Members

Member NameDescription
Assembly

Specifies that the field is accessible throughout the assembly.

FamANDAssem

Specifies that the field is accessible only by subtypes in this assembly.

Family

Specifies that the field is accessible only by type and subtypes.

FamORAssem

Specifies that the field is accessible by subtypes anywhere, as well as throughout this assembly.

FieldAccessMask

Specifies the access level of a given field.

HasDefault

Specifies that the field has a default value.

HasFieldMarshal

Specifies that the field has marshaling information.

HasFieldRVA

Specifies that the field has a relative virtual address (RVA). The RVA is the location of the method body in the current image, as an address relative to the start of the image file in which it is located.

InitOnly

Specifies that the field is initialized only, and can be set only in the body of a constructor.

Literal

Specifies that the field's value is a compile-time (static or early bound) constant. Any attempt to set it throws a FieldAccessException.

NotSerialized

Specifies that the field does not have to be serialized when the type is remoted.

PinvokeImpl

Reserved for future use.

Private

Specifies that the field is accessible only by the parent type.

PrivateScope

Specifies that the field cannot be referenced.

Public

Specifies that the field is accessible by any member for whom this scope is visible.

ReservedMask

Reserved.

RTSpecialName

Specifies that the common language runtime (metadata internal APIs) should check the name encoding.

SpecialName

Specifies a special method, with the name describing how the method is special.

Static

Specifies that the field represents the defined type, or else it is per-instance.

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0