Class AsyncExpression
- Namespace
- NCalc
- Assembly
- NCalc.Async.dll
This class represents a mathematical or logical expression that can be asynchronous evaluated. It supports caching, custom parameter and function evaluation, and options for handling null parameters and iterating over parameter collections. The class manages the parsing, validation, and evaluation of expressions, and provides mechanisms for error detection and reporting.
public class AsyncExpression : ExpressionBase<AsyncExpressionContext>
- Inheritance
-
AsyncExpression
- Inherited Members
Constructors
AsyncExpression(LogicalExpression)
public AsyncExpression(LogicalExpression logicalExpression)
Parameters
logicalExpression
LogicalExpression
AsyncExpression(LogicalExpression, AsyncExpressionContext?)
public AsyncExpression(LogicalExpression logicalExpression, AsyncExpressionContext? context = null)
Parameters
logicalExpression
LogicalExpressioncontext
AsyncExpressionContext
AsyncExpression(LogicalExpression, AsyncExpressionContext, ILogicalExpressionFactory, ILogicalExpressionCache, IAsyncEvaluationService)
public AsyncExpression(LogicalExpression logicalExpression, AsyncExpressionContext context, ILogicalExpressionFactory factory, ILogicalExpressionCache cache, IAsyncEvaluationService evaluationService)
Parameters
logicalExpression
LogicalExpressioncontext
AsyncExpressionContextfactory
ILogicalExpressionFactorycache
ILogicalExpressionCacheevaluationService
IAsyncEvaluationService
AsyncExpression(LogicalExpression, ExpressionOptions, CultureInfo?)
public AsyncExpression(LogicalExpression logicalExpression, ExpressionOptions options = ExpressionOptions.None, CultureInfo? cultureInfo = null)
Parameters
logicalExpression
LogicalExpressionoptions
ExpressionOptionscultureInfo
CultureInfo
AsyncExpression(string)
public AsyncExpression(string expression)
Parameters
expression
string
AsyncExpression(string, AsyncExpressionContext?)
public AsyncExpression(string expression, AsyncExpressionContext? context = null)
Parameters
expression
stringcontext
AsyncExpressionContext
AsyncExpression(string, AsyncExpressionContext, ILogicalExpressionFactory, ILogicalExpressionCache, IAsyncEvaluationService)
public AsyncExpression(string expression, AsyncExpressionContext context, ILogicalExpressionFactory factory, ILogicalExpressionCache cache, IAsyncEvaluationService evaluationService)
Parameters
expression
stringcontext
AsyncExpressionContextfactory
ILogicalExpressionFactorycache
ILogicalExpressionCacheevaluationService
IAsyncEvaluationService
AsyncExpression(string, ExpressionOptions, CultureInfo?)
public AsyncExpression(string expression, ExpressionOptions options = ExpressionOptions.None, CultureInfo? cultureInfo = null)
Parameters
expression
stringoptions
ExpressionOptionscultureInfo
CultureInfo
Properties
DynamicParameters
public IDictionary<string, AsyncExpressionParameter> DynamicParameters { get; set; }
Property Value
EvaluationService
protected IAsyncEvaluationService EvaluationService { get; }
Property Value
Functions
public IDictionary<string, AsyncExpressionFunction> Functions { get; set; }
Property Value
Methods
EvaluateAsync()
Asynchronously evaluates the logical expression.
public ValueTask<object?> EvaluateAsync()
Returns
Exceptions
- NCalcException
Thrown when there is an error in the expression.
Events
EvaluateFunctionAsync
Event triggered to handle function evaluation.
public event AsyncEvaluateFunctionHandler EvaluateFunctionAsync
Event Type
EvaluateParameterAsync
Event triggered to handle parameter evaluation.
public event AsyncEvaluateParameterHandler EvaluateParameterAsync