File Versions

  • Thread starter Thread starter Dennis C. Drumm
  • Start date Start date
D

Dennis C. Drumm

I have a strong named Windows Form application that save and opens files
using a BinaryFormatter. The formatter is set to
FormatterAssemblyStyle.Simple and I use the IFormatter interface to
serialize and deserialize the stream.

The problem comes when I need to change the structure of the object that is
serialized. Thereafter, I need to devise a way to open the old document
formats and convert them to the new format.

I can do that, but I need a way to determine what version of file I'm
opening so that I can use the proper deserialze object. Is there a way to
access the assembly version a binary streaming file was created with? Or,
alternatively, is the a versioning number that can be saved with this type
of file that can be used for that purpose at a later date?

Thanks,

Dennis
 
Hi Dennis,

I think you may override the default serialization, and add some version
information to the front of the serialized file.
In the deserialization, first read the version information your serialized
to determine whether this file was you wanted version.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Thank you!

I also figured out that I can deserialize to an object and then get the type
information about the object (which includes assembly information) and then
decide which object was deserialized.

Dennis
 
Back
Top