Table of Contents

Class Storage<T>

Namespace
BotManager.Runtime
Assembly
BotManager.Runtime.dll

A dictionary with text keys to store all kind of data. Used for the variables in RuntimeContext. The value type for the storage objects.

public class Storage<T>

Type Parameters

T
Inheritance
Storage<T>
Inherited Members

Constructors

Storage()

Creates an empty storage.

public Storage()

Storage(Storage<T>)

Copies the original storage into this one.

public Storage(Storage<T> original)

Parameters

original Storage<T>

The original storage to copy from.

Methods

Get(string)

Gets a value with the given key. Throws an exception if the key doesn't exist.

public T Get(string key)

Parameters

key string

The key of the entry.

Returns

T

Set(string, T?)

Sets the value with the given key. Overwrites existing entries. If value is null, it will remove the entry.

public void Set(string key, T? value)

Parameters

key string

The key of the entry.

value T

The value to set.

TryGet(string, out T)

Gets a value with the given key.

public bool TryGet(string key, out T value)

Parameters

key string

The key of the entry.

value T

Returns the found value.

Returns

bool

Returns if the value was found.

TryGet<TValue>(string, out TValue)

Gets a value with the given key and of type TValue.

public bool TryGet<TValue>(string key, out TValue value)

Parameters

key string

The key of the entry.

value TValue

Returns the found value.

Returns

bool

Returns if the value was found and it matches the type.

Type Parameters

TValue