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 = 0x00000000, Private = 0x00000001, FamANDAssem = 0x00000002, Assembly = 0x00000003, Family = 0x00000004, FamORAssem = 0x00000005, Public = 0x00000006, FieldAccessMask = 0x00000007, Static = 0x00000010, InitOnly = 0x00000020, Literal = 0x00000040, NotSerialized = 0x00000080, HasFieldRVA = 0x00000100, SpecialName = 0x00000200, RTSpecialName = 0x00000400, HasFieldMarshal = 0x00001000, PinvokeImpl = 0x00002000, HasDefault = 0x00008000, ReservedMask = 0x00009500 }
Hierarchy
System.Object
→
System.ValueType
→
System.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, Second Edition 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.