How to make your existing and new applications support in-memory transactions, multi-level and multi-document undo/redo, using Generics and C# 3.0 extension methods and lambda expressions.
Introduction
Do your applications support Undo/Redo? They often should, because Undo/Redo improves usability by enabling user exploration. Nowadays, it can also be a great competitive advantage. Just think of a word processor without it. But, how can you implement such functionality in a .NET application? This article presents a new approach to make both new and existing classes support multi-level undo and redo using Generics, extension methods, and lambda expressions.
Even if your application does not need support user Undo and Redo, you still might be interested to use the reversible transaction support presented here to build much error-safer applications. If you have ever worked with databases, you should be familiar with how SqlTransaction can group a number of changes as an atomic operation, which either fully succeeds (commits) or is completely rolled-back. With the framework presented here, you can do the same with in-memory objects.
The CodeProject article, Automatic Undo/Redo with .NET Generics, inspired me to start thinking of how to support undo and redo in applications. As shown there, property changes could easily be made undoable by w
Go to the complete details ...