using System.Collections.Generic;
public static void Main()
List<Parent> parents = new List<Parent>() { new Child1(), new Child2()};
Database<Parent> db = new Database<Parent>();
foreach (Parent parent in parents)
db.Add(parent, Guid.NewGuid());
foreach (Parent parent in db.storage.Values)
Console.WriteLine(parent.GetType());
public Dictionary<Guid,T> storage = new Dictionary<Guid, T>();
public void Add(T obj, Guid id) { storage[id] = obj; }
public void Remove(Guid id) { storage.Remove(id); }
public class Child1 : Parent
public class Child2 : Parent