What is the need for Memento Pattern in C#?C# provides
you an option to externalize internal state of an object for restoring
it at a later point of time. This is made possible by implementing Memento
Pattern. To implement this pattern, three classes are required. The mementoClass
will store the objects internal state.
The ownerClass will have privileges to restore the objects state. The safeKeepingClass will ensure safety of the information in mementoClass. This class will not have rights to access the contents of mementoClass. Here is a sample code demonstrating it: public class
mementoClass {
|