In this design pattern we save the state of object into xml or in memory stream so that it can be restored when needed.The memento pattern doesn’t violate encapsulation of the internal state. The pattern is rarely used but it’s very helpful in scientific computing or in computer games (saving of check points in the game for example).
Use Cases for the Memento Pattern
You should use the pattern in the following cases:
* You need to save object’s state and use the saved state later in order to
* restore the saved state.
* You don’t want to expose the internal state of your object.
public class CUser
{
// Get data from database in a dataset object
Dataset objDs =null;
//Write in xml
objDs.WriteXml(XmlPath);
//With this Xml file you can again create the same dataset.
objDs.ReadXml(XmlPath);
}
Saturday, November 13, 2010
Subscribe to:
Post Comments (Atom)
Followers
Link
Labels
Agille
(3)
Angular 2
(96)
Architecture
(7)
ASP .Net
(30)
C#/VB .Net
(161)
Entityframework
(11)
General
(33)
Git
(2)
Hosting
(2)
HTML
(4)
Interview
(12)
Interview-Agile
(1)
Interview-Angular
(25)
Interview-ASP .Net
(3)
Interview-C#
(16)
Interview-JavaScript
(1)
Interview-MVC
(30)
Interview-SQL Server
(4)
Interview-WCF
(2)
Islam
(6)
Java Script
(37)
JQuery
(1)
MVC
(53)
NodeJS
(1)
Puzzles
(1)
React-Native
(3)
Security
(1)
Shayri
(10)
SQL Server
(41)
VC++
(5)
WCF
(21)
Web API
(27)
WPF
(21)
No comments:
Post a Comment