diff --git a/ICSharpCode.Decompiler/Ast/Transforms/ReplaceMethodCallsWithOperators.cs b/ICSharpCode.Decompiler/Ast/Transforms/ReplaceMethodCallsWithOperators.cs index 1b949df27..25215179f 100644 --- a/ICSharpCode.Decompiler/Ast/Transforms/ReplaceMethodCallsWithOperators.cs +++ b/ICSharpCode.Decompiler/Ast/Transforms/ReplaceMethodCallsWithOperators.cs @@ -62,6 +62,19 @@ namespace Decompiler.Transforms ); return null; } + if (methodRef.Name == "op_Explicit" && arguments.Length == 1) { + arguments[0].Remove(); // detach argument + invocationExpression.ReplaceWith( + arguments[0].CastTo(AstBuilder.ConvertType(methodRef.ReturnType, methodRef.MethodReturnType)) + .WithAnnotation(methodRef) + ); + return null; + } + if (methodRef.Name == "op_Implicit" && arguments.Length == 1) { + arguments[0].Remove(); // detach argument + invocationExpression.ReplaceWith(arguments[0]); + return null; + } return null; }