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.
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
contextRuntimeContextThe current runtime context.
returnTypeTypeThe expected return type. Use
typeof(object)for a generic result. Usenullif you don't need the return value.