O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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()}

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required