Enum TypeSystemOptions
- Namespace
- ICSharpCode.Decompiler.TypeSystem
- Assembly
- ICSharpCode.Decompiler.dll
Options that control how metadata is represented in the type system.
[Flags]
public enum TypeSystemOptions
Fields
DecimalConstants = 32
If this option is active, [DecimalConstantAttribute] is removed and constant values are transformed into simple decimal literals.
Default = Dynamic | Tuple | ExtensionMethods | DecimalConstants | ReadOnlyStructsAndParameters | RefStructs | UnmanagedConstraints | NullabilityAnnotations | ReadOnlyMethods | NativeIntegers | FunctionPointers | LifetimeAnnotations | NativeIntegersWithoutAttribute
Default settings: typical options for the decompiler, with all C# languages features enabled.
Dynamic = 1
[DynamicAttribute] is used to replace 'object' types with the 'dynamic' type.
If this option is not active, the 'dynamic' type is not used, and the attribute is preserved.
ExtensionMethods = 4
If this option is active, [ExtensionAttribute] is removed and methods are marked as IsExtensionMethod. Otherwise, the attribute is preserved but the methods are not marked.
FunctionPointers = 8192
Allow function pointer types. If this option is not enabled, function pointers are replaced with the 'IntPtr' type.
KeepModifiers = 64
If this option is active, modopt and modreq types are preserved in the type system.
Note: the decompiler currently does not support handling modified types; activating this option may lead to incorrect decompilation or internal errors.
[Obsolete("Use ScopedRef instead")] LifetimeAnnotations = 16384
NativeIntegers = 4096
[NativeIntegerAttribute] is used to replace 'IntPtr' types with the 'nint' type.
NativeIntegersWithoutAttribute = 32768
Replace 'IntPtr' types with the 'nint' type even in absence of [NativeIntegerAttribute]. Note: DecompilerTypeSystem constructor removes this setting from the options if not targeting .NET 7 or later.
None = 0
No options enabled; stay as close to the metadata as possible.
NullabilityAnnotations = 1024
If this option is active, [NullableAttribute] is removed and reference types with nullability annotations are used instead.
OnlyPublicAPI = 8
Only load the public API into the type system.
ReadOnlyMethods = 2048
If this option is active, [IsReadOnlyAttribute] on methods is removed and the method marked as ThisIsRefReadOnly.
ReadOnlyStructsAndParameters = 128
If this option is active, [IsReadOnlyAttribute] on parameters+structs is removed and parameters are marked as in, structs as readonly. Otherwise, the attribute is preserved but the parameters and structs are not marked.
RefStructs = 256
If this option is active, [IsByRefLikeAttribute] is removed and structs are marked as ref. Otherwise, the attribute is preserved but the structs are not marked.
ScopedRef = 16384
Allow C# 11 scoped annotation. If this option is not enabled, ScopedRefAttribute will be reported as custom attribute.
Tuple = 2
Tuple types are represented using the TupleType class. [TupleElementNames] is used to name the tuple elements.
If this option is not active, the tuples are represented using their underlying type, and the attribute is preserved.
Uncached = 16
Do not cache accessed entities. In a normal type system (without this option), every type or member definition has exactly one ITypeDefinition/IMember instance. This instance is kept alive until the whole type system can be garbage-collected. When this option is specified, the type system avoids these caches. This reduces the memory usage in many cases, but increases the number of allocations. Also, some code in the decompiler expects to be able to compare type/member definitions by reference equality, and thus will fail with uncached type systems.
UnmanagedConstraints = 512
If this option is active, [IsUnmanagedAttribute] is removed from type parameters, and HasUnmanagedConstraint is set instead.