Checksum support needed

May 5, 2011 at 6:44 PM

Hi, I use sharpSerializer for serializing and deserializing the state of WP7 application. Unfortunatly, if the battery is discharged the stream is cut off. No exception is thrown. Instead some properties are just null. What would be needed to implement checksum support?


May 11, 2011 at 2:03 AM
Edited May 11, 2011 at 2:04 AM

hi, Make a class (a wrapper) with two properties:

Prop1 - HashCode as int

Prop2 - your actual class with data

In your data class and all its complex descendants override the GetHashCode Method to get the unique checksum for all important properties.

Before storing, compute this checksum and store it in the Prop1

After loading, compute es again and compare with the stored value.