3

Assume object A has 6 fields, now the object A is serialized, after some time the 3 more fields are added and the object is deserialized.

  1. Adding of the new fields will create any exception when deserializing.
  2. How to have a backward compatibility
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Raghav55
  • 3,055
  • 6
  • 28
  • 38

3 Answers3

5

Read Version Tolerant Serialization

Muhammad Hasan Khan
  • 34,648
  • 16
  • 88
  • 131
0

Generally add a version and implement custom serialization via ISerializable.

Handle appropriate defaults and or throw more appropriate exceptions there.

See here

Mirko
  • 4,284
  • 1
  • 22
  • 19
0

.Net has something called "Version Tolerant Serialization" ;)

Check out this easy to understand example on object serialization:

http://programming.flashadventures.com/c-sharp/writing-objects-to-files-serialization/

Jon Arnar
  • 11
  • 1