Table of Contents

Class Choose

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

Executes and returns a random item from this list.

Return type is the type of the chosen item.

This json example returns either 1, 2 or 3 chosen randomly:
{ "$Choose": [ 1, 2, 3 ] }
[JsonConverter(typeof(ListConverter<Choose>))]
public sealed class Choose : List<IExpression?>, IList<IExpression?>, ICollection<IExpression?>, IList, ICollection, IReadOnlyList<IExpression?>, IReadOnlyCollection<IExpression?>, IEnumerable<IExpression?>, IEnumerable, IExpression
Inheritance
Choose
Implements
Inherited Members

Constructors

Choose()

public Choose()

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.