Table of Contents

Class Function

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

Registers a new function in the runtime context. Use Call to execute it later.

Return type is null.

This json example executes registers a user-defined function "MyFunction":
{ "$Function": { "Name": "MyFunction", "Action": 10 } }
public sealed class Function : IExpression
Inheritance
Function
Implements
Inherited Members

Constructors

Function()

public Function()

Properties

Action

Gets and sets the expression that is executed when the stored function is called.

public IExpression? Action { get; set; }

Property Value

IExpression

Name

Gets and sets the name of the function.

public string? Name { get; set; }

Property Value

string

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.