Table of Contents

Enum ExpressionOptions

Namespace
NCalc
Assembly
NCalc.dll

Options used for both parsing and evaluation of an expression.

[Flags]
public enum ExpressionOptions : long

Fields

AllowBooleanCalculation = 512

Allow calculation with bool values.

AllowCharValues = 4096

Parse single quoted strings as char.

AllowNullOrEmptyExpressions = 16384

Return the value instead of throwing an exception when the expression is null or empty.

AllowNullParameter = 128

Defines a "null" parameter and allows comparison of values to null.

AvoidDynamicFunctions = 68719476736

Specifies that Dynamic functions should not be used (required for AOT).

CaseInsensitiveStringComparer = 32

Specifies the use of CaseInsensitiveComparer for comparisons.

CompareIncompatibleTypes = 34359738368

Specifies that if incompatible types are compared, the comparison evaluates to false instead of failing with an exception

CompareNullValues = 268435456

Specifies that comparison of null values should take place (a non-null value has precedence) instead of shortcutting to false.

DecimalAsDefault = 64

Uses decimals instead of doubles as default floating point data type.

DontParseDates = 131072

Disables parsing of dates for faster parsing

DontParseGuids = 65536

Disables parsing of GUIDs for faster processing

HexBinOctAreUnsigned = 134217728

Specifies that values expressed as hex, binary, or octal are treated as unsigned values. This has meaning only for the values above long.MaxValue.

IgnoreCaseAtBuiltInFunctions = 2

Specifies case-insensitive matching for built-in functions.

IterateParameters = 8

Treats parameters as arrays and returns a set of results.

LowerCaseIdentifierLookup = 524288

Convert identifiers to lowercase before looking up in the parameter and functions dictionary

NoCache = 4

No-cache mode. Ignores any pre-compiled expression in the cache.

NoStringTypeCoercion = 8192

Disables coercion of string values to other types.

None = 0

Specifies that no options are set.

OrdinalStringComparer = 256

Use ordinal culture on string compare.

OverflowProtection = 1024

Check for arithmetic binary operation overflow.

ReduceDivResultToInteger = 33554432

When enabled and during the Divide operation, there is no remainder to the division, an integer type is used for a result; otherwise, the result is always float (double or extended)

RoundAwayFromZero = 16

When using Round(), if a number is halfway between two others, it is rounded toward the nearest number that is away from zero.

SkipLogicalAndBitwiseOpChars = 1048576

Disables the use of the ampersand, |, ^, ~ characters for logical and bitwise operations; opting for AND, OR, XOR, NOT, as well as BIT_AND, BIT_OR, BIT_XOR, and BIT_NOT instead. When this flag is enabled, ^ is used for powers (together with **)

StrictTypeMatching = 32768

Enables strict type matching, where comparisons between objects of different types will return false. This also applies to LIKE and NOT LIKE operations - if StrictTypeMatching is enabled, the operands must be strings.

StringConcat = 2048

Concat values as strings instead of arithmetic addition.

SupportCStyleComments = 1073741824

When set, the parser will recognize C-style line and block comments in expressions.

SupportPythonComments = -2147483648

When set, the parser will recognize Python comments in expressions.

SupportTimeOperations = 262144

Support math operations (+/-) with DateTime and Timespan and between Timespans

TreatNullAsZero = 536870912

When set, null will be converted to zero in math expressions.

UseAssignments = 4194304

When enabled, supports assignment statements and update of parameters. By default, the feature is disabled for performance.

UseBigNumbers = 67108864

BigInteger is to be used as the last resort when parsing numbers. BigDecimal will be used when dividing two BigIntegers or two BigDecimals.

UseCStyleAssignments = 8388608

Enables the use of "=" for assignments and "==" for the equality operator. When not enabled, both "=" and "==" are used for the equality operator and assignment is done with ":="

UseIfStatement = 8589934592

When set, recognizes the if() statement, and "if" is not used for a function. When not set, if() is used as an alias to the built-in "iff" function.

UseLoops = 4294967296

When set, while() loop statement is supported. The safety fuse, a limit of loop iterations, is set via Expression.MaxLoopIterations/AsyncExpression.MaxLoopIterations. The default value is 65536.

UseNonRecursiveEvaluator = 17179869184

When set, the non-recursive evaluator is used. It is slower but enables evaluation of deeply-nested or just very long expressions.

UseStatementSequences = 16777216

When enabled, supports sequences of statements separated by ';'

UseUnicodeCharsForOperations = 2097152

Enables the use of certain Unicode characters to denote some math operations