Class EvaluationHelper
Provides helper methods for evaluating expressions.
public static class EvaluationHelper- Inheritance
- 
      
      EvaluationHelper
- Inherited Members
Methods
In(object?, object?, ExpressionContextBase)
Determines if the left value is contained within the right value, which must be either an enumerable or a string.
public static bool In(object? rightValue, object? leftValue, ExpressionContextBase context)Parameters
- rightValueobject
- The right operand. 
- leftValueobject
- The left operand. 
- contextExpressionContextBase
- The evaluation context. 
Returns
- bool
- True if the left value is contained within the right value, otherwise false. 
Exceptions
- NCalcEvaluationException
- Thrown when the right value is not an enumerable or a string. 
Like(object?, object?, ExpressionContextBase)
Determines whether a specified string matches a pattern using SQL-like wildcards.
public static bool Like(object? leftValue, object? rightValue, ExpressionContextBase context)Parameters
- leftValueobject
- The left operand. 
- rightValueobject
- The right operand. 
- contextExpressionContextBase
- The context containing options for the comparison. 
Returns
- bool
- trueif the- valuematches the- pattern; otherwise,- false.
Remarks
The comparison is case-insensitive if the CaseInsensitiveStringComparer flag is set in the context.
Like(string, string, ExpressionContextBase)
Determines whether a specified string matches a pattern using SQL-like wildcards.
[Obsolete]
public static bool Like(string value, string pattern, ExpressionContextBase context)Parameters
- valuestring
- The string to be compared against the pattern. 
- patternstring
- The pattern to match. '%' matches zero or more characters, and '_' matches exactly one character. 
- contextExpressionContextBase
- The context containing options for the comparison. 
Returns
- bool
- trueif the- valuematches the- pattern; otherwise,- false.
Remarks
The comparison is case-insensitive if the CaseInsensitiveStringComparer flag is set in the context.
Plus(object?, object?, ExpressionContextBase)
Adds two values, with special handling for string concatenation based on the context options.
public static object? Plus(object? leftValue, object? rightValue, ExpressionContextBase context)Parameters
- leftValueobject
- The left operand. 
- rightValueobject
- The right operand. 
- contextExpressionContextBase
- The evaluation context. 
Returns
- object
- The result of the addition or string concatenation. 
Unary(UnaryExpression, object?, ExpressionContextBase)
Evaluates a unary expression.
public static object? Unary(UnaryExpression expression, object? result, ExpressionContextBase context)Parameters
- expressionUnaryExpression
- The unary expression to evaluate. 
- resultobject
- The result of evaluating the operand of the unary expression. 
- contextExpressionContextBase
- The evaluation context. 
Returns
- object
- The result of the unary operation. 
Exceptions
- InvalidOperationException
- Thrown when the unary expression type is unknown.