Using system;
Namespace Pattern {/// /// summary description for class1. /// summary> public class memento {public int number; public string file = "; public memory {numler = m. Number; file = m.file;}} public class originator {public string file = ""; public originator () {} // creates a MEMENTO PUBLIC Memento getMEMEMEMEMEMEMETINTO () NEW MEMENTO (this);} // Restore to the original value public void setmemento (memento m) {Number = m.Number; file = m.file;}
}} // Memo Originator o = new Originator (); o.file = "old file"; =umber = 100; memento m = o.getMemento (); o.file = "new file"; nr = 2100; O.SetMemento (M); console.writeLine (o.file);