walter
walter

Reputation: 823

Quick way to find that object was updated

I do deserialize object from database on application start, then during application life time user can update object, and at the end object are serialized back into db as xml string. Is there any way to find out that object was updated other than comparing initial and final string.

I know that is possible to use:

  1. String.GetHashCode Method, but as noted that "Different strings can return the same hash code".

  2. MD5 hash as done in How to compute and compare hash values by using Visual C#. Although I don't know if different strings can return same MD5 hash.

I know that my xml always will be less than 100KB.

Upvotes: 3

Views: 271

Answers (1)

Sam
Sam

Reputation: 15770

Implement IPropertyChanged, and track if the object is dirty or not.

Upvotes: 2

Related Questions