You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is perhaps a convenience rather than true bug, nonetheless it proves inconvenient.
In the case where the conditional part of an "if" function (function.Expression[0]) returns an empty string, it is not evaluated as false, it simply throws a System.FormatException from Convert.ToBoolean(object, IFormatProvider).
Since throwing and handling Exceptions can be processing expensive when using the Ncalc library over large data sets, it would be better to either handle a variety of values via the ToBoolean overload without a format provider, or by using Boolean.TryParse to cleanly handle cases of failed conversion and null/empty values.
The text was updated successfully, but these errors were encountered:
This is perhaps a convenience rather than true bug, nonetheless it proves inconvenient.
In the case where the conditional part of an "if" function (function.Expression[0]) returns an empty string, it is not evaluated as false, it simply throws a System.FormatException from Convert.ToBoolean(object, IFormatProvider).
In fact, because of the chosen ToBoolean method used (with a format provider), many of the common true/false values cannot be used, e.g 0/1 (https://learn.microsoft.com/en-us/dotnet/api/system.convert.toboolean?view=net-8.0)
Since throwing and handling Exceptions can be processing expensive when using the Ncalc library over large data sets, it would be better to either handle a variety of values via the ToBoolean overload without a format provider, or by using Boolean.TryParse to cleanly handle cases of failed conversion and null/empty values.
The text was updated successfully, but these errors were encountered: