© Vaskaran Sarcar 2020
V. SarcarDesign Patterns in C#https://doi.org/10.1007/978-1-4842-6062-3_19

19. Memento Pattern

Vaskaran Sarcar1 
(1)
Garia, Kolkata, West Bengal, India
 

This chapter covers the Memento pattern.

GoF Definition

Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later.

Concept

The word memento is a reminder of past events. By following an object-oriented approach, you can also track (or save) the states of an object. So, whenever you want to restore an object to its previous state, you can consider using this pattern.

In this pattern, you commonly see three participants: memento, originator, and caretaker (often used as a client). The working flow can be ...

Get Design Patterns in C#: A Hands-on Guide with Real-world Examples now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.