Table of Contents

Class Async

Namespace
BotManager.Runtime.Expressions
Assembly
BotManager.Runtime.dll

Runs the Expression in a new thread.

Return type is null.

This json example waits 5 seconds in a async thread, but doesn't block the main thread and returns null:
{ "$Async": { "$Delay": 5000 } }
[JsonConverter(typeof(AsyncConverter))]
public sealed class Async : IExpression
Inheritance
Async
Implements
Inherited Members

Constructors

Async()

Empty constructor for serialization.

public Async()

Async(IExpression?)

Creates an expression that is runs another expression in another thread.

public Async(IExpression? expression)

Parameters

expression IExpression

The expression.

Properties

Expression

Gets and sets the expression.

[JsonRootProperty]
public IExpression? Expression { get; set; }

Property Value

IExpression

Methods

ExecuteAsync(RuntimeContext, Type?)

Executes the expression in the given RuntimeContext. Please do not use this method to run an expression. Use ExecuteAsync(IExpression?) instead.

public Task<object?> ExecuteAsync(RuntimeContext context, Type? returnType)

Parameters

context RuntimeContext

The current runtime context.

returnType Type

The expected return type. Use typeof(object) for a generic result. Use null if you don't need the return value.

Returns

Task<object>

Returns the result of the expression.