Class DecompilerSettings
- Namespace
- ICSharpCode.Decompiler
- Assembly
- ICSharpCode.Decompiler.dll
Settings for the decompiler.
public class DecompilerSettings : INotifyPropertyChanged
- Inheritance
-
DecompilerSettings
- Implements
- Inherited Members
Constructors
DecompilerSettings()
Equivalent to new DecompilerSettings(LanguageVersion.Latest)
public DecompilerSettings()
DecompilerSettings(LanguageVersion)
Creates a new DecompilerSettings instance with initial settings appropriate for the specified language version.
public DecompilerSettings(LanguageVersion languageVersion)
Parameters
languageVersion
LanguageVersion
Remarks
This does not imply that the resulting code strictly uses only language features from that version. Language constructs like generics or ref locals cannot be removed from the compiled code.
Properties
AggressiveInlining
If set to false (the default), the decompiler will inline local variables only when they occur in a context where the C# compiler is known to emit compiler-generated locals. If set to true, the decompiler will inline local variables whenever possible.
public bool AggressiveInlining { get; set; }
Property Value
AggressiveScalarReplacementOfAggregates
[Browsable(false)]
public bool AggressiveScalarReplacementOfAggregates { get; set; }
Property Value
AlwaysCastTargetsOfExplicitInterfaceImplementationCalls
Gets/Sets whether to always cast targets to explicitly implemented methods.
true: ((ISupportInitialize)pictureBox1).BeginInit();
false: pictureBox1.BeginInit();
default: false
public bool AlwaysCastTargetsOfExplicitInterfaceImplementationCalls { get; set; }
Property Value
AlwaysQualifyMemberReferences
Gets/Sets whether to always qualify member references.
true: this.DoSomething();
false: DoSomething();
default: false
public bool AlwaysQualifyMemberReferences { get; set; }
Property Value
AlwaysShowEnumMemberValues
Gets/Sets whether to always show enum member values.
true: enum Kind { A = 0, B = 1, C = 5 }
false: enum Kind { A, B, C = 5 }
default: false
public bool AlwaysShowEnumMemberValues { get; set; }
Property Value
AlwaysUseBraces
Gets/Sets whether to use braces for single-statement-blocks.
public bool AlwaysUseBraces { get; set; }
Property Value
AlwaysUseGlobal
Always fully qualify namespaces using the "global::" prefix.
public bool AlwaysUseGlobal { get; set; }
Property Value
AnonymousMethods
Decompile anonymous methods/lambdas.
public bool AnonymousMethods { get; set; }
Property Value
AnonymousTypes
Decompile anonymous types.
public bool AnonymousTypes { get; set; }
Property Value
ApplyWindowsRuntimeProjections
public bool ApplyWindowsRuntimeProjections { get; set; }
Property Value
ArrayInitializers
Gets/Sets whether to use array initializers. If set to false, might produce non-compilable code.
public bool ArrayInitializers { get; set; }
Property Value
AssumeArrayLengthFitsIntoInt32
Gets/Sets whether the decompiler can assume that 'ldlen; conv.i4.ovf' does not throw an overflow exception.
[Browsable(false)]
public bool AssumeArrayLengthFitsIntoInt32 { get; set; }
Property Value
AsyncAwait
Decompile async methods.
public bool AsyncAwait { get; set; }
Property Value
AsyncEnumerator
Decompile IAsyncEnumerator/IAsyncEnumerable. Only has an effect if AsyncAwait is enabled.
public bool AsyncEnumerator { get; set; }
Property Value
AsyncUsingAndForEachStatement
public bool AsyncUsingAndForEachStatement { get; set; }
Property Value
AutomaticEvents
Decompile automatic events
public bool AutomaticEvents { get; set; }
Property Value
AutomaticProperties
Decompile automatic properties
public bool AutomaticProperties { get; set; }
Property Value
AwaitInCatchFinally
Decompile await in catch/finally blocks. Only has an effect if AsyncAwait is enabled.
public bool AwaitInCatchFinally { get; set; }
Property Value
CSharpFormattingOptions
[Browsable(false)]
public CSharpFormattingOptions CSharpFormattingOptions { get; set; }
Property Value
CheckedOperators
Gets/Sets whether to use C# 11.0 user-defined checked operators.
public bool CheckedOperators { get; set; }
Property Value
CovariantReturns
Decompile C# 9 covariant return types.
public bool CovariantReturns { get; set; }
Property Value
DecimalConstants
Decompile [DecimalConstant(...)] as simple literal values.
public bool DecimalConstants { get; set; }
Property Value
DecompileMemberBodies
Gets/Sets whether member bodies should be decompiled.
[Browsable(false)]
public bool DecompileMemberBodies { get; set; }
Property Value
Deconstruction
Gets/Sets whether C# 7.0 deconstruction should be detected.
public bool Deconstruction { get; set; }
Property Value
DictionaryInitializers
Gets/Sets whether to use C# 6.0 dictionary initializers. Only has an effect if ObjectOrCollectionInitializers is enabled.
public bool DictionaryInitializers { get; set; }
Property Value
Discards
Gets/Sets whether discards should be used when possible. Only has an effect if OutVariables is enabled.
public bool Discards { get; set; }
Property Value
DoWhileStatement
Gets/sets whether the decompiler should produce do-while loops.
public bool DoWhileStatement { get; set; }
Property Value
Dynamic
Decompile use of the 'dynamic' type.
public bool Dynamic { get; set; }
Property Value
ExpandMemberDefinitions
[Browsable(false)]
public bool ExpandMemberDefinitions { get; set; }
Property Value
ExpandUsingDeclarations
[Browsable(false)]
public bool ExpandUsingDeclarations { get; set; }
Property Value
ExpressionTrees
Decompile expression trees.
public bool ExpressionTrees { get; set; }
Property Value
ExtensionMethods
public bool ExtensionMethods { get; set; }
Property Value
ExtensionMethodsInCollectionInitializers
Gets/Sets whether to use C# 6.0 Extension Add methods in collection initializers. Only has an effect if ObjectOrCollectionInitializers is enabled.
public bool ExtensionMethodsInCollectionInitializers { get; set; }
Property Value
FileScopedNamespaces
Use C# 10 file-scoped namespaces.
public bool FileScopedNamespaces { get; set; }
Property Value
FixedBuffers
Decompile C# 1.0 'public unsafe fixed int arr[10];' members.
public bool FixedBuffers { get; set; }
Property Value
FoldBraces
[Browsable(false)]
public bool FoldBraces { get; set; }
Property Value
ForEachStatement
Decompile foreach statements.
public bool ForEachStatement { get; set; }
Property Value
ForEachWithGetEnumeratorExtension
Support GetEnumerator extension methods in foreach.
public bool ForEachWithGetEnumeratorExtension { get; set; }
Property Value
ForStatement
Gets/sets whether the decompiler should produce for loops.
public bool ForStatement { get; set; }
Property Value
FunctionPointers
Use C# 9 delegate* unmanaged
types.
If this option is disabled, function pointers will instead be decompiled with type IntPtr
.
public bool FunctionPointers { get; set; }
Property Value
GetterOnlyAutomaticProperties
Decompile getter-only automatic properties
public bool GetterOnlyAutomaticProperties { get; set; }
Property Value
InitAccessors
Use C# 9 init;
property accessors.
public bool InitAccessors { get; set; }
Property Value
IntroduceIncrementAndDecrement
Gets/Sets whether to use increment and decrement operators
[Browsable(false)]
public bool IntroduceIncrementAndDecrement { get; set; }
Property Value
IntroduceReadonlyAndInModifiers
Gets/Sets whether IsReadOnlyAttribute should be replaced with 'readonly' modifiers on structs and with the 'in' modifier on parameters.
public bool IntroduceReadonlyAndInModifiers { get; set; }
Property Value
IntroduceRefModifiersOnStructs
Gets/Sets whether IsByRefLikeAttribute should be replaced with 'ref' modifiers on structs.
public bool IntroduceRefModifiersOnStructs { get; set; }
Property Value
IntroduceUnmanagedConstraint
If this option is active, [IsUnmanagedAttribute] on type parameters is replaced with "T : unmanaged" constraints.
public bool IntroduceUnmanagedConstraint { get; set; }
Property Value
LifetimeAnnotations
[Obsolete("Renamed to ScopedRef. This property will be removed in a future version of the decompiler.")]
[Browsable(false)]
public bool LifetimeAnnotations { get; set; }
Property Value
LiftNullables
Use lifted operators for nullables.
public bool LiftNullables { get; set; }
Property Value
LoadInMemory
[Browsable(false)]
public bool LoadInMemory { get; set; }
Property Value
LocalFunctions
Gets/Sets whether C# 7.0 local functions should be transformed.
public bool LocalFunctions { get; set; }
Property Value
LockStatement
Decompile lock statements.
public bool LockStatement { get; set; }
Property Value
MakeAssignmentExpressions
Gets/Sets whether to use assignment expressions such as in while ((count = Do()) != 0) ;
[Browsable(false)]
public bool MakeAssignmentExpressions { get; set; }
Property Value
NamedArguments
Gets/Sets whether named arguments should be used.
public bool NamedArguments { get; set; }
Property Value
NativeIntegers
Use C# 9 nint
/nuint
types.
public bool NativeIntegers { get; set; }
Property Value
NonTrailingNamedArguments
Gets/Sets whether C# 7.2 non-trailing named arguments should be used.
public bool NonTrailingNamedArguments { get; set; }
Property Value
NullPropagation
Decompile C# 6 ?. and ?[] operators.
public bool NullPropagation { get; set; }
Property Value
NullableReferenceTypes
Gets/Sets whether C# 8.0 nullable reference types are enabled.
public bool NullableReferenceTypes { get; set; }
Property Value
NumericIntPtr
Treat IntPtr
/UIntPtr
as nint
/nuint
.
public bool NumericIntPtr { get; set; }
Property Value
ObjectOrCollectionInitializers
Gets/Sets whether to use C# 3.0 object/collection initializers.
public bool ObjectOrCollectionInitializers { get; set; }
Property Value
OptionalArguments
Gets/Sets whether optional arguments should be removed, if possible.
public bool OptionalArguments { get; set; }
Property Value
OutVariables
Gets/Sets whether out variable declarations should be used when possible.
public bool OutVariables { get; set; }
Property Value
ParameterNullCheck
Use C# 11 preview parameter null-checking (
string param!!
).
[Browsable(false)]
[Obsolete("This feature did not make it into C# 11, and may be removed in a future version of the decompiler.")]
public bool ParameterNullCheck { get; set; }
Property Value
PatternBasedFixedStatement
Gets/Sets whether C# 7.3 pattern based fixed statement should be used.
public bool PatternBasedFixedStatement { get; set; }
Property Value
PatternCombinators
Gets/Sets whether C# 9.0 and, or, not patterns should be detected.
public bool PatternCombinators { get; set; }
Property Value
PatternMatching
Gets/Sets whether C# 7.0 pattern matching should be detected.
public bool PatternMatching { get; set; }
Property Value
QueryExpressions
public bool QueryExpressions { get; set; }
Property Value
Ranges
Gets/Sets whether C# 8.0 index and range syntax should be used.
public bool Ranges { get; set; }
Property Value
ReadOnlyMethods
public bool ReadOnlyMethods { get; set; }
Property Value
RecordClasses
Use C# 9 record
classes.
public bool RecordClasses { get; set; }
Property Value
RecordStructs
Use C# 10 record
structs.
public bool RecordStructs { get; set; }
Property Value
RecursivePatternMatching
Gets/Sets whether C# 8.0 recursive patterns should be detected.
public bool RecursivePatternMatching { get; set; }
Property Value
RefExtensionMethods
Gets/Sets whether to use C# 7.2 'ref' extension methods.
public bool RefExtensionMethods { get; set; }
Property Value
RelationalPatterns
Gets/Sets whether C# 9.0 relational patterns should be detected.
public bool RelationalPatterns { get; set; }
Property Value
RemoveDeadCode
public bool RemoveDeadCode { get; set; }
Property Value
RemoveDeadStores
public bool RemoveDeadStores { get; set; }
Property Value
RequiredMembers
Use C# 11 required
modifier.
public bool RequiredMembers { get; set; }
Property Value
ScopedRef
Use C# 11 scoped
modifier.
public bool ScopedRef { get; set; }
Property Value
SeparateLocalVariableDeclarations
Gets/sets whether the decompiler should separate local variable declarations from their initialization.
public bool SeparateLocalVariableDeclarations { get; set; }
Property Value
ShowDebugInfo
[Browsable(false)]
public bool ShowDebugInfo { get; set; }
Property Value
ShowXmlDocumentation
Gets/Sets whether to include XML documentation comments in the decompiled code.
public bool ShowXmlDocumentation { get; set; }
Property Value
SparseIntegerSwitch
public bool SparseIntegerSwitch { get; set; }
Property Value
StackAllocInitializers
Gets/Sets whether C# 7.3 stackalloc initializers should be used.
public bool StackAllocInitializers { get; set; }
Property Value
StaticLocalFunctions
Gets/Sets whether C# 8.0 static local functions should be transformed.
public bool StaticLocalFunctions { get; set; }
Property Value
StringConcat
Decompile 'string.Concat(a, b)' calls into 'a + b'.
public bool StringConcat { get; set; }
Property Value
StringInterpolation
Gets/Sets whether to use C# 6.0 string interpolation
public bool StringInterpolation { get; set; }
Property Value
SwitchExpressions
Use C# 8 switch expressions.
public bool SwitchExpressions { get; set; }
Property Value
SwitchOnReadOnlySpanChar
Gets/Sets whether to use C# 11.0 switch on (ReadOnly)Span<char>
public bool SwitchOnReadOnlySpanChar { get; set; }
Property Value
SwitchStatementOnString
public bool SwitchStatementOnString { get; set; }
Property Value
ThrowExpressions
Gets/Sets whether throw expressions should be used.
public bool ThrowExpressions { get; set; }
Property Value
ThrowOnAssemblyResolveErrors
[Browsable(false)]
public bool ThrowOnAssemblyResolveErrors { get; set; }
Property Value
TupleComparisons
Gets/Sets whether tuple comparisons should be detected.
public bool TupleComparisons { get; set; }
Property Value
TupleConversions
Gets/Sets whether implicit conversions between tuples should be used in the decompiled output.
public bool TupleConversions { get; set; }
Property Value
TupleTypes
Gets/Sets whether tuple type syntax (int, string)
should be used for System.ValueTuple
.
public bool TupleTypes { get; set; }
Property Value
UnsignedRightShift
Gets/Sets whether to use C# 11.0 unsigned right shift operator.
public bool UnsignedRightShift { get; set; }
Property Value
UseDebugSymbols
Gets/Sets whether to use variable names from debug symbols, if available.
public bool UseDebugSymbols { get; set; }
Property Value
UseEnhancedUsing
Use enhanced using statements.
public bool UseEnhancedUsing { get; set; }
Property Value
UseExpressionBodyForCalculatedGetterOnlyProperties
Gets/Sets whether simple calculated getter-only property declarations should use expression body syntax.
public bool UseExpressionBodyForCalculatedGetterOnlyProperties { get; set; }
Property Value
UseImplicitMethodGroupConversion
Gets/Sets whether to use C# 2.0 method group conversions.
true: EventHandler h = this.OnClick;
false: EventHandler h = new EventHandler(this.OnClick);
public bool UseImplicitMethodGroupConversion { get; set; }
Property Value
UseLambdaSyntax
Use C# 3 lambda syntax if possible.
public bool UseLambdaSyntax { get; set; }
Property Value
UseNestedDirectoriesForNamespaces
Gets/sets whether namespaces and namespace-like identifiers should be split at '.' and each part should produce a new level of nesting in the output directory structure.
public bool UseNestedDirectoriesForNamespaces { get; set; }
Property Value
UsePrimaryConstructorSyntax
Use primary constructor syntax with records.
public bool UsePrimaryConstructorSyntax { get; set; }
Property Value
UseRefLocalsForAccurateOrderOfEvaluation
Gets/Sets whether to use local ref variables in cases where this is necessary for re-compilation with a modern C# compiler to reproduce the same behavior as the original assembly produced with an old C# compiler that used an incorrect order of evaluation. See https://github.com/icsharpcode/ILSpy/issues/2050
public bool UseRefLocalsForAccurateOrderOfEvaluation { get; set; }
Property Value
UseSdkStyleProjectFormat
Gets or sets a value indicating whether the new SDK style format shall be used for the generated project files.
public bool UseSdkStyleProjectFormat { get; set; }
Property Value
UsingDeclarations
public bool UsingDeclarations { get; set; }
Property Value
UsingStatement
Decompile using statements.
public bool UsingStatement { get; set; }
Property Value
Utf8StringLiterals
Gets/Sets whether to use C# 11.0 UTF-8 string literals
public bool Utf8StringLiterals { get; set; }
Property Value
WithExpressions
Use C# 9 with
initializer expressions.
public bool WithExpressions { get; set; }
Property Value
YieldReturn
Decompile enumerators.
public bool YieldReturn { get; set; }
Property Value
Methods
Clone()
public DecompilerSettings Clone()
Returns
GetMinimumRequiredVersion()
public LanguageVersion GetMinimumRequiredVersion()
Returns
OnPropertyChanged(string)
protected virtual void OnPropertyChanged(string propertyName = null)
Parameters
propertyName
string
SetLanguageVersion(LanguageVersion)
Deactivates all language features from versions newer than languageVersion
.
public void SetLanguageVersion(LanguageVersion languageVersion)
Parameters
languageVersion
LanguageVersion
Events
PropertyChanged
public event PropertyChangedEventHandler PropertyChanged