public void AddOrReplace(EntityAppearance app) { Type t = app.GetType(); if (!t.IsSerializable) { throw new IntegrityViolation("Trying to add non-serializable appearance to collection: " + t); } members[app.GetType()] = app; }
public void Add(EntityAppearance app) { Type t = app.GetType(); if (!t.IsSerializable) { throw new IntegrityViolation("Trying to add non-serializable appearance to collection: " + t); } if (Contains(t)) { throw new IntegrityViolation("This appearance already exists in this collection"); } members.Add(t, app); }