The classes store various program settings. I need to save these classes to files so that users can open and modify these files.
At first I used binary serialization. She has her flaw. For example, I saved a class in which there are 5 fields, then something changed in the program, and in this class there were 6 fields. As a result, deserialize the class from this file will not work.
Then I wrote my solution, which saved the classes in sqlite local db. It is convenient enough, but it also takes time to support the solution. And now, when faced with the need to upgrade one’s own solution, I thought that maybe it’s worth looking for something that is ready and more universal in order not to support its solution :)
So, we are looking for a ready-made solution that allows saving program classes to files. The main thing is that when the number of fields in a class changes, the file is deserialized, and it would be ideal if the missing fields are filled with default values.
DefaultValueattribute. Do not forget to assign the same value in the constructor. - VladD