Name

FieldAttributes

Synopsis

This is an enumeration of the attributes that can be specified on a field. Assembly means that the field is internal (that is, private to the assembly); Family indicates that the field is protected. Private, Public and Static are self-explanatory. If the field has a default value, HasDefault is marked; if a field is constant, Literal is marked. InitOnly indicates that the field can only be set on object initialization. To exclude a field from being serialized, NotSerialized should be asserted. HasFieldMarshal specifies that the field has special marshaling information.

public enum FieldAttributes {
   PrivateScope = 0,
   Private = 1,
   FamANDAssem = 2,
   Assembly = 3,
   Family = 4,
   FamORAssem = 5,
   Public = 6,
   FieldAccessMask = 7,
   Static = 16,
   InitOnly = 32,
   Literal = 64,
   NotSerialized = 128,
   HasFieldRVA = 256,
   SpecialName = 512,
   RTSpecialName = 1024,
   HasFieldMarshal = 4096,
   PinvokeImpl = 8192,
   HasDefault = 32768,
   ReservedMask = 38144
}

Hierarchy

System.ObjectSystem.ValueTypeSystem.Enum(System.IComparable, System.IFormattable, System.IConvertible)FieldAttributes

Returned By

FieldInfo.Attributes

Passed To

System.Reflection.Emit.ModuleBuilder.{DefineInitializedData(), DefineUninitializedData()}, System.Reflection.Emit.TypeBuilder.{DefineField(), DefineInitializedData(), DefineUninitializedData()}

Get C# in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.