Click here to Skip to main content
13,457,673 members
Rate this:
Please Sign up or sign in to vote.

I'm implementing a project where I have a complex state object which needs to be stored away and at a later date consumed by a number of different services.

The nature of this state object is that it is going to evolve where additional properties are added to the object.

My concern is that older versions of the object are going to fail the deserialization process with each evolution of the object.

I've looked into the use of custom serialization using ISerializable and also aiding the default serialization process by applying the NonSerialized attribute to any new properties.

What I'm hope for is some feedback from developers who've previously faced this type of issue and if they point out some pit falls or problems with either the ISerializable or NonSerialized approach, or perhaps recommend a third approach I haven't yet contemplated?
Posted 31-Jan-13 0:44am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

In asking my question I found the right terminology to find the answer in google.

From .Net 2.0 onwards the framework has supported "Version Tolerant Serialization".

This provides a number of tools for managing serialisation and deserialisation of object of different versions.

These includes attributes such as OptionalField, OnDeserializing, OnDeserialized, OnSerializing and OnSerialized.[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01-2016 | 2.8.180322.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100