コード例 #1
0
        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();
        }
コード例 #2
0
 public Caretaker(Originator originator)
 {
     this._originator = originator;
 }