Talking .NET WinForms here:
If you have an application where someone can change items using some properties dialog for example, how do you determine if a user has changed something when he clicks on cancel (to decide whether to display a cancel confirmation message box, or not).
I can think of 2 methods:
- Defining a dirty bit and handling all "changed" events to set this bit to true.
- Clone the original object and write some comparison code to determine if the modified object really was modified compared with the original
Is there any more elegant and/or more generic way to do that?