Class ExpressionBase<TExpressionContext>
- Namespace
- NCalc
- Assembly
- NCalc.Core.dll
Base class with common utilities of AST parsing and evaluation.
public abstract class ExpressionBase<TExpressionContext> where TExpressionContext : ExpressionContextBase, new()
Type Parameters
TExpressionContext
- Inheritance
-
ExpressionBase<TExpressionContext>
- Derived
- Inherited Members
Constructors
ExpressionBase(LogicalExpression, TExpressionContext, ILogicalExpressionFactory, ILogicalExpressionCache)
protected ExpressionBase(LogicalExpression logicalExpression, TExpressionContext context, ILogicalExpressionFactory logicalExpressionFactory, ILogicalExpressionCache logicalExpressionCache)
Parameters
logicalExpression
LogicalExpressioncontext
TExpressionContextlogicalExpressionFactory
ILogicalExpressionFactorylogicalExpressionCache
ILogicalExpressionCache
ExpressionBase(string, TExpressionContext, ILogicalExpressionFactory, ILogicalExpressionCache)
protected ExpressionBase(string expressionString, TExpressionContext context, ILogicalExpressionFactory logicalExpressionFactory, ILogicalExpressionCache logicalExpressionCache)
Parameters
expressionString
stringcontext
TExpressionContextlogicalExpressionFactory
ILogicalExpressionFactorylogicalExpressionCache
ILogicalExpressionCache
ExpressionBase(TExpressionContext?)
protected ExpressionBase(TExpressionContext? context = null)
Parameters
context
TExpressionContext
Properties
Context
protected TExpressionContext Context { get; }
Property Value
- TExpressionContext
CultureInfo
Culture information for the expression evaluation.
public CultureInfo CultureInfo { get; set; }
Property Value
Error
public Exception? Error { get; }
Property Value
ExpressionString
Textual representation of the expression.
public string? ExpressionString { get; protected init; }
Property Value
LogicalExpression
public LogicalExpression? LogicalExpression { get; protected set; }
Property Value
Options
Options for the expression evaluation.
public ExpressionOptions Options { get; set; }
Property Value
Parameters
Parameters for the expression evaluation.
public IDictionary<string, object?> Parameters { get; set; }
Property Value
Methods
GetFunctionNames()
Returns a list with all function names from the expression.
public List<string> GetFunctionNames()
Returns
GetLogicalExpression()
protected LogicalExpression? GetLogicalExpression()
Returns
GetParameterNames()
Returns a list with all parameter names from the expression.
public List<string> GetParameterNames()
Returns
HasErrors()
Create the LogicalExpression in order to check syntax errors. If errors are detected, the Error property contains the exception.
public bool HasErrors()
Returns
- bool
True if the expression syntax is correct, otherwise False.