public static void Run() { var originator = new Originator { Name = "Name1", Address = "Address1" }; originator.DisplayBasicInfo(); var caretaker = new Caretaker { Memento = originator.RestoreMemento() }; originator.Name = "Name2"; originator.Address = "Address2"; originator.DisplayBasicInfo(); originator.SetMemento(caretaker.Memento); originator.DisplayBasicInfo(); }
public Caretaker(Originator originator) { this._originator = originator; }