From 53fd4558d797a8837559bb15ff1ab645d8bce5d8 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Wed, 2 Mar 2022 09:30:54 +0100 Subject: [PATCH] Fix .NET35 build --- src/System.Linq.Dynamic.Core/Parser/ExpressionPromoter.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/System.Linq.Dynamic.Core/Parser/ExpressionPromoter.cs b/src/System.Linq.Dynamic.Core/Parser/ExpressionPromoter.cs index 4cd0a720..f5632b16 100644 --- a/src/System.Linq.Dynamic.Core/Parser/ExpressionPromoter.cs +++ b/src/System.Linq.Dynamic.Core/Parser/ExpressionPromoter.cs @@ -105,11 +105,12 @@ public virtual Expression Promote(Expression expr, Type type, bool exact, bool c if (TypeHelper.IsCompatibleWith(expr.Type, type)) { - if (type == typeof(decimal) && expr.Type.IsEnum) + if (type == typeof(decimal) && TypeHelper.IsEnumType(expr.Type)) { return Expression.Convert(Expression.Convert(expr, Enum.GetUnderlyingType(expr.Type)), type); } - else if (type.GetTypeInfo().IsValueType || exact || expr.Type.GetTypeInfo().IsValueType && convertExpr) + + if (type.GetTypeInfo().IsValueType || exact || expr.Type.GetTypeInfo().IsValueType && convertExpr) { return Expression.Convert(expr, type); }