Table of Contents

Class Format

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

Formats a string by using Format(string, params object[]).

Return type is string.

This json example returns "Hello World! 1 + 2 = 3":
{ "$Format": { "Text": "Hello {0}! {1} + {2} = {3}", "Parameters": [ "World", 1, 2, 3 ] } }
public sealed class Format : IExpression
Inheritance
Format
Implements
Inherited Members

Constructors

Format()

Empty constructor for serialization.

public Format()

Format(IExpression, List)

Creates am expression that returns the result of Format(string, params object[]).

public Format(IExpression text, List parameters)

Parameters

text IExpression

The format text.

parameters List

The list of parameters to insert.

Format(string, List)

Creates am expression that returns the result of Format(string, params object[]).

public Format(string text, List parameters)

Parameters

text string

The format text.

parameters List

The list of parameters to insert.

Properties

Parameters

Gets and sets the parameter list.

public List? Parameters { get; set; }

Property Value

List

Text

Gets and sets the format text.

public IExpression? Text { 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.