public void SetData(string key, BlackBoardData data) { if (blackBoardData.ContainsKey(key)) { blackBoardData[key] = data; } else { blackBoardData.Add(key, data); } }
public BlackBoardData <T> SetData <T>(string key, T data) { if (blackBoardData.ContainsKey(key)) { if (blackBoardData[key] is BlackBoardData <T> bbd) { bbd.data = data; } else { blackBoardData[key] = new BlackBoardData <T>(data); } } else { blackBoardData.Add(key, new BlackBoardData <T>(data)); } return((BlackBoardData <T>)blackBoardData[key]); }