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