legacy software
-
Hi, Last year I created a program that uses binary serialization for file saving. In the near future I'm planning on creating a new revision of this program, which will include many class structure changes from the current version. It seems that when using object serialization, adding and changing variables to current classes will cause errors during deserialization of older files. Are there ways to allow files created by older software versions to be compatible with newer ones? This is an area of programming I've never really explored. I'm unsure of common practices. Thanks for any tips!
-
Hi, Last year I created a program that uses binary serialization for file saving. In the near future I'm planning on creating a new revision of this program, which will include many class structure changes from the current version. It seems that when using object serialization, adding and changing variables to current classes will cause errors during deserialization of older files. Are there ways to allow files created by older software versions to be compatible with newer ones? This is an area of programming I've never really explored. I'm unsure of common practices. Thanks for any tips!
If you're using C# 2005 you can use the [OptionalFieldAttribute] on new class variables, and when you deserialize the class, the vars that have the above tag wont be required and therefore wont throw an exception. If you're using C# 2003, you can look into manually controlling the serialization process. BTW: M$ is giving away C#, VB, and C++ express for free until Nov. 2006. If you get them before then, you will never have to pay for them. You can download CD images of each.