Mid GoF Patterns

Memento:?

  • The TextMemento class holds the state of the TextEditor object. It only exposes

the state (the text content) and doesn’t allow direct manipulation of that state.

  • The Memento is a snapshot of the internal state of the TextEditor.

public class TextMemento

public string Text { get; }

public TextMemento(string text) => Text = text;

Follow:

More from Design Patterns in C#

All questions for this course