NanoByte.Common 2.11.0
Undo system

The NanoByte.Common.Undo namespace provides a framework for adding undo/redo functionality to your applications.


Commands that can be executed and also undone are represented using the IUndoCommand interface.

This library provides a number of implementations for common use cases such as SetValueCommand and AddToCollection, but you can also implement your own.


Methods that wish to execute IUndoCommands should take an ICommandExecutor as an input parameter.
To execute an IUndoCommand pass it to the ICommandExecutor.Execute() method. This will then internally call IUndoCommand.Execute() and record the command for later undo operations.

The class CommandManager implements the ICommandExecutor interface. You can expose this classes .Undo() and .Redo() methods to your users in your GUI.