Skip to content

Commit 29ae77c

Browse files
Florian KroenertFlorian Kroenert
authored andcommitted
Fix some issues
1 parent 17178ee commit 29ae77c

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/lib/Xrm.Oss.XTL.Interpreter/FunctionHandlers.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,8 +1052,15 @@ private static T CheckedCast<T>(object input, string errorMessage, bool failOnEr
10521052
var value = parameters[0].Value;
10531053

10541054
// Handle special CRM types
1055-
if (value is Money money) value = money.Value;
1056-
if (value is OptionSetValue optionSet) value = optionSet.Value;
1055+
if (value is Money)
1056+
{
1057+
value = ((Money) value).Value;
1058+
}
1059+
1060+
if (value is OptionSetValue)
1061+
{
1062+
value = ((OptionSetValue) value).Value;
1063+
}
10571064

10581065
// Support both styles:
10591066
// Format(value, { format: "C2" })
@@ -1071,9 +1078,9 @@ private static T CheckedCast<T>(object input, string errorMessage, bool failOnEr
10711078
formatted = string.Format(CultureInfo.InvariantCulture, formatString, value);
10721079
}
10731080
// Otherwise, use direct formatting
1074-
else if (value is IFormattable formattable)
1081+
else if (value is IFormattable)
10751082
{
1076-
formatted = formattable.ToString(formatString, CultureInfo.InvariantCulture);
1083+
formatted = ((IFormattable) value).ToString(formatString, CultureInfo.InvariantCulture);
10771084
}
10781085
else
10791086
{

0 commit comments

Comments
 (0)