Table of Contents

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 LogicalExpression
context AsyncExpressionContext

AsyncExpression(LogicalExpression, AsyncExpressionContext, ILogicalExpressionFactory, ILogicalExpressionCache, IAsyncEvaluationService)

public AsyncExpression(LogicalExpression logicalExpression, AsyncExpressionContext context, ILogicalExpressionFactory factory, ILogicalExpressionCache cache, IAsyncEvaluationService evaluationService)

Parameters

logicalExpression LogicalExpression
context AsyncExpressionContext
factory ILogicalExpressionFactory
cache ILogicalExpressionCache
evaluationService IAsyncEvaluationService

AsyncExpression(LogicalExpression, ExpressionOptions, CultureInfo?)

public AsyncExpression(LogicalExpression logicalExpression, ExpressionOptions options = ExpressionOptions.None, CultureInfo? cultureInfo = null)

Parameters

logicalExpression LogicalExpression
options ExpressionOptions
cultureInfo CultureInfo

AsyncExpression(string)

public AsyncExpression(string expression)

Parameters

expression string

AsyncExpression(string, AsyncExpressionContext?)

public AsyncExpression(string expression, AsyncExpressionContext? context = null)

Parameters

expression string
context AsyncExpressionContext

AsyncExpression(string, AsyncExpressionContext, ILogicalExpressionFactory, ILogicalExpressionCache, IAsyncEvaluationService)

public AsyncExpression(string expression, AsyncExpressionContext context, ILogicalExpressionFactory factory, ILogicalExpressionCache cache, IAsyncEvaluationService evaluationService)

Parameters

expression string
context AsyncExpressionContext
factory ILogicalExpressionFactory
cache ILogicalExpressionCache
evaluationService IAsyncEvaluationService

AsyncExpression(string, ExpressionOptions, CultureInfo?)

public AsyncExpression(string expression, ExpressionOptions options = ExpressionOptions.None, CultureInfo? cultureInfo = null)

Parameters

expression string
options ExpressionOptions
cultureInfo CultureInfo

Properties

DynamicParameters

public IDictionary<string, AsyncExpressionParameter> DynamicParameters { get; set; }

Property Value

IDictionary<string, AsyncExpressionParameter>

EvaluationService

protected IAsyncEvaluationService EvaluationService { get; }

Property Value

IAsyncEvaluationService

Functions

public IDictionary<string, AsyncExpressionFunction> Functions { get; set; }

Property Value

IDictionary<string, AsyncExpressionFunction>

Methods

EvaluateAsync()

Asynchronously evaluates the logical expression.

public ValueTask<object?> EvaluateAsync()

Returns

ValueTask<object>

The result of the evaluation.

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

AsyncEvaluateFunctionHandler

EvaluateParameterAsync

Event triggered to handle parameter evaluation.

public event AsyncEvaluateParameterHandler EvaluateParameterAsync

Event Type

AsyncEvaluateParameterHandler