473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Question about Serializing classes

I'm developing a new application and want to use serialization as a way to
save my data.
But as I add new variables to my classes, how will serializing cope with
that?
For example, suppose I have a class called Point which has 2 variables X and
Y.
I save a few jobs (by serializing), and then enhance my application by
adding a Z variable.
How will serializing behave when loading those jobs that were created before
Z was added?

Nov 21 '05 #1
2 1322
Simon,
One of the following articles on serialization discusses how to version your
classes using serialization. I implement ISerializable and write a version
tag, then when I read I read the version tag to decide if the "new"
information is present or not.

http://msdn.microsoft.com/msdnmag/issues/02/04/net/
http://msdn.microsoft.com/msdnmag/issues/02/07/net/
http://msdn.microsoft.com/msdnmag/issues/02/09/net/

Hope this helps
Jay
"Simon" <si***@ssm.com> wrote in message
news:eg**************@TK2MSFTNGP12.phx.gbl...
I'm developing a new application and want to use serialization as a way to
save my data.
But as I add new variables to my classes, how will serializing cope with
that?
For example, suppose I have a class called Point which has 2 variables X and Y.
I save a few jobs (by serializing), and then enhance my application by
adding a Z variable.
How will serializing behave when loading those jobs that were created before Z was added?

Nov 21 '05 #2
It certainly does help.

Thanks

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
Simon,
One of the following articles on serialization discusses how to version your classes using serialization. I implement ISerializable and write a version
tag, then when I read I read the version tag to decide if the "new"
information is present or not.

http://msdn.microsoft.com/msdnmag/issues/02/04/net/
http://msdn.microsoft.com/msdnmag/issues/02/07/net/
http://msdn.microsoft.com/msdnmag/issues/02/09/net/

Hope this helps
Jay
"Simon" <si***@ssm.com> wrote in message
news:eg**************@TK2MSFTNGP12.phx.gbl...
I'm developing a new application and want to use serialization as a way to save my data.
But as I add new variables to my classes, how will serializing cope with
that?
For example, suppose I have a class called Point which has 2 variables X

and
Y.
I save a few jobs (by serializing), and then enhance my application by
adding a Z variable.
How will serializing behave when loading those jobs that were created

before
Z was added?


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Angelos Karantzalis | last post by:
Hi guys. I've come across a problem when I tried to serialize a class into xml, only to discover that the parent class's XML Serialization properties weren't included in the output xml. ...
2
by: Aleksei Guzev | last post by:
Imagine one writing a class library CL1 for data storage. He defines classes ‘DataItem’ and ‘DataRecord’ so that the latter contains a collection of the former. And he derives class ‘IntItem’ from...
0
by: Ante Smolcic | last post by:
Hi all, I have an ArrayList that contains items of type A. I declared the XmlArrayItem atribute for that type. Now I have an derived type B (from A) also contained in the ArrayList but I get...
4
by: Wayne Wengert | last post by:
I am still stuck trying to create a Class to use for exporting and importing array data to/from XML. The format of the XML that I want to import/export is shown below as is the Class and the code I...
1
by: Ivo Bronsveld | last post by:
All, I have quite a challenging task ahead of me. I need to write an object model (for code access) based on a schema, which cannot be made into a dataset because of it's complexity. So I...
10
by: copx | last post by:
I want to save a struct to disk.... as plain text. At the moment I do it with a function that just writes the data using fprintf. I mean like this: fprintf(fp, "%d %d", my_struct.a, my_struct.b)...
2
by: Tobias Zimmergren | last post by:
Hi, just wondering what serializing really is, and howto use it? Thanks. Tobias __________________________________________________________________ Tobias ICQ#: 55986339 Current ICQ status: +...
0
by: Julia Beresford | last post by:
Hi I have a VB .NET class library with classes and collection classes (classes that implement ICollection) that allow a client to read and write data to and from an SQL database. For example if...
2
by: she_prog | last post by:
I have a class derived from UserControl. I need to serialize an object of this class, but only some properties of it, as not all properties are serializable (some of the properties coming from...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.