Table of Contents

Class Env

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

Returns the value of a variable from the system environment variables.

Return type is string.

This json example returns the value of the environment variable "MY_VAR":
{ "$Env": "MY_VAR" }
[JsonConverter(typeof(EnvConverter))]
public sealed class Env : IExpression
Inheritance
Env
Implements
Inherited Members

Constructors

Env()

Empty constructor for serialization.

public Env()

Env(string)

Creates an expression that returns the system environment variable with the given name.

public Env(string name)

Parameters

name string

The name of the environment variable.

Properties

Name

Gets and sets the name of the variable.

[JsonRootProperty]
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.