V
Victory
Hi,
I have an application in C# which writes a structure that
the user compiles/enters to a file on disk. Now, the initial
version of the application (version 1.0) uses a structure
that has x number of members. When a new request for change
comes up that requires a change in the structure i have to
add a new member to the structure (hence version 2.0). The
users who created their saved data structure with version
1.0 now want to open their files and those who are creating
new files, will be written data onto the disk with structure
of version 2.0. How do i make the program to read the data
and map what is read to the correct structure? The
structure contains a number of strings, ints, Classes,
Hashtables, as well as List<Classes> and so forth. So, i am
writting the structure as binary (serialized) to disk and
obviously reading back the same way.
In code, i have to do this type (psudeo):
- Find the version of file
- if version 1.o, open the file using structure version 1.o,
cast it to the correct structure type.
- if version 2.o, open the file using structure version 1.o,
cast it to the correct structure type.
now, when i want to process the information in the structure
(like traverse it and display it, etc.), i want to use the
same structure regardless of the structure. Is there a way
using Reflections to do this that makes things easier?
thanks,
Mars
I have an application in C# which writes a structure that
the user compiles/enters to a file on disk. Now, the initial
version of the application (version 1.0) uses a structure
that has x number of members. When a new request for change
comes up that requires a change in the structure i have to
add a new member to the structure (hence version 2.0). The
users who created their saved data structure with version
1.0 now want to open their files and those who are creating
new files, will be written data onto the disk with structure
of version 2.0. How do i make the program to read the data
and map what is read to the correct structure? The
structure contains a number of strings, ints, Classes,
Hashtables, as well as List<Classes> and so forth. So, i am
writting the structure as binary (serialized) to disk and
obviously reading back the same way.
In code, i have to do this type (psudeo):
- Find the version of file
- if version 1.o, open the file using structure version 1.o,
cast it to the correct structure type.
- if version 2.o, open the file using structure version 1.o,
cast it to the correct structure type.
now, when i want to process the information in the structure
(like traverse it and display it, etc.), i want to use the
same structure regardless of the structure. Is there a way
using Reflections to do this that makes things easier?
thanks,
Mars