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.
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
originalStorage<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
keystringThe 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
keystringThe key of the entry.
valueTThe value to set.
TryGet(string, out T)
Gets a value with the given key.
public bool TryGet(string key, out T value)
Parameters
keystringThe key of the entry.
valueTReturns 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
keystringThe key of the entry.
valueTValueReturns the found value.
Returns
- bool
Returns if the value was found and it matches the type.
Type Parameters
TValue