I have a class that is serialized to and from an XML file when the user decided to open or save. I try to add typical functionality when, when I try to close a form with saved changes, the form warns them and gives them the option to save until they close.
I added the HasUnsavedChanges property to my class, which my form validates before closing. However, it is a little annoying that my properties have changed from something like this.
public string Name { get; set; }
to that...
private string _Name; public string Name { get { return _Name; } set { this._Name = value; this.HasUnsavedChanges = true; } }
Is there a better way to track class instance changes? For example, is there some standard way that I can “hash” an instance of a class into a value that I can use to compare the latest version with the saved version without omitting every property in the class?
source share