ISerializable and backward compatibility

Posted by pierusch on Stack Overflow See other posts from Stack Overflow or by pierusch
Published on 2010-04-10T15:34:02Z Indexed on 2010/04/10 16:03 UTC
Read the original article Hit count: 527

hello I have to work an an old application that used binaryFormatter to serialize application data into filestream (say in a file named "data.oldformat") without any optimizazion the main class has been marked with attribute

<serializable()>public MainClass
....... 
end class

and the serialization code

dim b as new binaryformatter
b.serialize(mystream,mymainclass)

In an attempt to optimize the serialization/deserialization process I simply made the class implement the ISerializable interface and wrote some optimized serialization routines

<serializable()>public MainClass
       implements ISerializable
....... 
end class

The optimization works really well but I MUST find a way to reatrive the data inside the old files for backward compatibility.

How can I do that??

Pierluigi

© Stack Overflow or respective owner

Related posts about .NET

Related posts about iserializable