To give a little background.
I created an application that allows users to save settings and then call the settings later. For this, I created some serializable objects. I got this to work using BinaryFormatter without much trouble.
When I start to encounter problems, I update the software and add new settings. Now my serializable objects do not match, and so I have to update the files. I have done this successfully for several versions. But for this, I try to deserialize the file, and if it throws an exception, I try to use the next version. And then the next. And then the next. Until I find the correct one. Then I have to write conversion functions for each of the old versions in order to convert it to the latest version. I also created a “revision” file, so I can just check which version they have and then update it, but I still need to save a lot of different “versions” and write conversion functions for all of them ,,which seems inherently messy for me and prone to bloat later on the line if I continue along this route.
There must be a better way to do this, I'm just not sure how to do this.
thank
source
share