private void ExecuteInTransation(Action transaction) { var memento = new UserMemento(this); try { transaction(); } catch (Exception) { Restore(memento); throw; } }
private void Restore(UserMemento memento) { Coins = new CoinStock(memento.Coins); }