public void AddThenGet() { object o = new object(); subject.Add("hi"); subject.Add(10); subject.Add(o); Assert.AreEqual("hi", subject.Get <string>()); Assert.AreEqual(10, subject.Get <int>()); Assert.AreSame(o, subject.Get <object>()); }
static DataLibrary() { foreach (var type in AppDomain.CurrentDomain.GetAssemblies().SelectMany(s => s.GetTypes()).Where(p => p.BaseType == typeof(DataBase))) { DictionaryByType.Add(type, new Dictionary <string, DataBase>()); InsertByStringType.Add(type.Name.Replace("Data", ""), jobj => { var data = (DataBase)jobj.ToObject(type); DictionaryByType[type].Add(data.Name, data); }); } }