29 lines
624 B
C#
29 lines
624 B
C#
|
namespace Ether
|
||
|
{
|
||
|
public abstract class DataBase
|
||
|
{
|
||
|
private DictionaryEx<string, object> allDataDic = new DictionaryEx<string, object>();
|
||
|
|
||
|
public bool AddData(string name, object value)
|
||
|
{
|
||
|
if (allDataDic.ContainsKey(name))
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
allDataDic.Add(name, value);
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public T GetData<T>(string name)
|
||
|
{
|
||
|
if (allDataDic.TryGetValue(name, out object value))
|
||
|
{
|
||
|
return (T)value;
|
||
|
}
|
||
|
|
||
|
return default;
|
||
|
}
|
||
|
}
|
||
|
}
|