diff --git a/ICSharpCode.Decompiler/Ast/AstBuilder.cs b/ICSharpCode.Decompiler/Ast/AstBuilder.cs index 75c3ea029..2f4660a2d 100644 --- a/ICSharpCode.Decompiler/Ast/AstBuilder.cs +++ b/ICSharpCode.Decompiler/Ast/AstBuilder.cs @@ -95,6 +95,8 @@ namespace ICSharpCode.Decompiler.Ast if (settings.AnonymousMethods && IsAnonymousMethodCacheField(field)) return true; if (settings.AutomaticProperties && IsAutomaticPropertyBackingField(field)) + return true; + if (settings.SwitchStatementOnString && IsSwitchOnStringCache(field)) return true; } // event-fields are not [CompilerGenerated] @@ -105,6 +107,11 @@ namespace ICSharpCode.Decompiler.Ast return false; } + static bool IsSwitchOnStringCache(FieldDefinition field) + { + return field.Name.StartsWith("<>f__switch", StringComparison.Ordinal); + } + static bool IsAutomaticPropertyBackingField(FieldDefinition field) { return field.HasGeneratedName() && field.Name.EndsWith("BackingField", StringComparison.Ordinal);