How flags are shown
Some fields hold one of several values in a group of bits (visibility, layout); every other bit is one flag. The explorer prints the number in hex and the names that are set; a bit with no name is printed as hex so nothing is hidden. The values below are the ones the explorer names.
TypeAttributes (TypeDef.Flags, 4 bytes)
| Mask | Values |
|---|---|
| 0x7 visibility | 0 NotPublic, 1 Public, 2 NestedPublic, 3 NestedPrivate, 4 NestedFamily, 5 NestedAssembly, 6 NestedFamANDAssem, 7 NestedFamORAssem |
| 0x18 layout | 0 AutoLayout, 0x8 SequentialLayout, 0x10 ExplicitLayout |
| 0x20 | 0 Class, 0x20 Interface |
| 0x30000 string format | 0 AnsiClass, 0x10000 UnicodeClass, 0x20000 AutoClass, 0x30000 CustomFormatClass |
| single bits | 0x80 Abstract, 0x100 Sealed, 0x400 SpecialName, 0x800 RTSpecialName, 0x1000 Import, 0x2000 Serializable, 0x4000 WindowsRuntime, 0x40000 BeforeFieldInit, 0x200000 HasSecurity, 0x40000000 Forwarder |
FieldAttributes (Field.Flags, 2 bytes)
| Mask | Values |
|---|---|
| 0x7 access | 0 CompilerControlled, 1 Private, 2 FamANDAssem, 3 Assembly, 4 Family, 5 FamORAssem, 6 Public |
| single bits | 0x10 Static, 0x20 InitOnly, 0x40 Literal, 0x80 NotSerialized, 0x100 HasFieldRVA, 0x200 SpecialName, 0x400 RTSpecialName, 0x1000 HasFieldMarshal, 0x2000 PinvokeImpl, 0x8000 HasDefault |
MethodAttributes (MethodDef.Flags, 2 bytes)
| Mask | Values |
|---|---|
| 0x7 access | 0 CompilerControlled, 1 Private, 2 FamANDAssem, 3 Assem, 4 Family, 5 FamORAssem, 6 Public |
| 0x100 | 0 ReuseSlot, 0x100 NewSlot |
| single bits | 0x10 Static, 0x20 Final, 0x40 Virtual, 0x80 HideBySig, 0x200 CheckAccessOnOverride, 0x400 Abstract, 0x800 SpecialName, 0x1000 RTSpecialName, 0x2000 PinvokeImpl, 0x4000 UnmanagedExport, 0x8000 HasSecurity |
MethodImplAttributes (MethodDef.ImplFlags, 2 bytes)
| Mask | Values |
|---|---|
| 0x3 code type | 0 IL, 1 Native, 2 OPTIL, 3 Runtime |
| 0x4 | 0 Unmanaged, 0x4 Managed |
| single bits | 0x8 ForwardRef, 0x10 PreserveSig, 0x20 Synchronized, 0x40 NoInlining, 0x80 NoOptimization, 0x100 AggressiveInlining, 0x200 AggressiveOptimization, 0x1000 InternalCall |
ParamAttributes (Param.Flags, 2 bytes)
0x1 In, 0x2 Out, 0x4 Lcid, 0x8 Retval, 0x10 Optional, 0x1000 HasDefault, 0x2000 HasFieldMarshal.
EventAttributes and PropertyAttributes
Event.EventFlags: 0x200 SpecialName, 0x400 RTSpecialName. Property.Flags: 0x200 SpecialName, 0x400 RTSpecialName, 0x1000 HasDefault.
Method semantics (MethodSemantics.Semantics, 2 bytes)
0x1 Setter, 0x2 Getter, 0x4 Other, 0x8 AddOn, 0x10 RemoveOn, 0x20 Fire.
GenericParamAttributes (GenericParam.Flags, 2 bytes)
Mask 0x3 variance: 0 None, 1 Covariant, 2 Contravariant. Bits: 0x4 ReferenceTypeConstraint (class), 0x8 NotNullableValueTypeConstraint (struct), 0x10 DefaultConstructorConstraint (new()), 0x20 AllowByRefLike (allows ref struct).
PInvokeAttributes (ImplMap.MappingFlags, 2 bytes)
| Mask | Values |
|---|---|
| 0x6 character set | 0 CharSetNotSpec, 0x2 CharSetAnsi, 0x4 CharSetUnicode, 0x6 CharSetAuto |
| 0x700 calling convention | 0x100 Platformapi, 0x200 Cdecl, 0x300 Stdcall, 0x400 Thiscall, 0x500 Fastcall |
| 0x3000 best fit | 0x1000 BestFitEnabled, 0x2000 BestFitDisabled |
| single bits | 0x1 NoMangle, 0x40 SupportsLastError |
AssemblyFlags (Assembly.Flags, AssemblyRef.Flags, 4 bytes)
0x1 PublicKey (the key column holds the full key, not a token), 0x100 Retargetable, 0x4000 DisableJITcompileOptimizer, 0x8000 EnableJITcompileTracking.
CLR header flags
0x1 ILONLY, 0x2 32BITREQUIRED, 0x4 IL_LIBRARY, 0x8 STRONGNAMESIGNED, 0x10 NATIVE_ENTRYPOINT, 0x10000 TRACKDEBUGDATA, 0x20000 32BITPREFERRED. An image that is not ILONLY holds native code as well: a mixed-mode (C++/CLI) image, or a precompiled one.
Not described
Known, not yet covered
- Reference: the meaning of each flag in the runtime (what
BeforeFieldInitchanges about type initialisation, howHideBySigaffects overload resolution) is not explained; this page lists the values. - Viewer: the ExportedType flags, ManifestResource visibility and File flags are named as in the specification; flag combinations the specification forbids are not reported.
Links
Reference
- ECMA-335 – partition II section 23.1: the flag enumerations