473,395 Members | 2,798 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,395 software developers and data experts.

serialization on static values

Hello
Im having trouble serializing a static value inside an object and
deserialize it correctly.
Heres how it works

The idea is that i make lots of objects that has unique IDs, but each object
share one value and that is the ID of the last object created. This way i
know what the ID of the next object will be. So lets say 10 objects share
one value (static).
I create 10 objects and the static variable= 10. on all thos objects...

Now i serialize these objects inside a List<T>.
And close the application. Then i start the application and load in the
objects i serilized, but the problem is that the static value is reset, its
= 0....

That means that the static value did not serialize like the rest of the
objects.
How can i fix this? that my Shared value is saved.

When i load the 10 objects i want that share variable to be 10 and not 0.

thank you.
Feb 21 '06 #1
2 1202
Remember, serialization is serializing instances of the objects. Static data
is not serialized because it's not instance data and there's really no way
to "automatically" do it.

Either store the count somewhere or after you load all the objects, set the
value to the highest ID.

Pete

"Deleo" <De***@noemail.noemail> wrote in message
news:eg**************@TK2MSFTNGP11.phx.gbl...
Hello
Im having trouble serializing a static value inside an object and
deserialize it correctly.
Heres how it works

The idea is that i make lots of objects that has unique IDs, but each
object share one value and that is the ID of the last object created. This
way i know what the ID of the next object will be. So lets say 10 objects
share one value (static).
I create 10 objects and the static variable= 10. on all thos objects...

Now i serialize these objects inside a List<T>.
And close the application. Then i start the application and load in the
objects i serilized, but the problem is that the static value is reset,
its = 0....

That means that the static value did not serialize like the rest of the
objects.
How can i fix this? that my Shared value is saved.

When i load the 10 objects i want that share variable to be 10 and not 0.

thank you.

Feb 21 '06 #2
ok thanks
Ill work around it then....
just wanted to know if I could serialize the thing :)

"Deleo" <De***@noemail.noemail> wrote in message
news:eg**************@TK2MSFTNGP11.phx.gbl...
Hello
Im having trouble serializing a static value inside an object and
deserialize it correctly.
Heres how it works

The idea is that i make lots of objects that has unique IDs, but each
object share one value and that is the ID of the last object created. This
way i know what the ID of the next object will be. So lets say 10 objects
share one value (static).
I create 10 objects and the static variable= 10. on all thos objects...

Now i serialize these objects inside a List<T>.
And close the application. Then i start the application and load in the
objects i serilized, but the problem is that the static value is reset,
its = 0....

That means that the static value did not serialize like the rest of the
objects.
How can i fix this? that my Shared value is saved.

When i load the 10 objects i want that share variable to be 10 and not 0.

thank you.

Feb 22 '06 #3

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

Similar topics

1
by: Mike Frayn | last post by:
Hello again, Okay, I was reading the following tutorial on serialization of user-defined classes, and it seems pretty straightforward: http://www.sys-con.com/story/?storyid=44199 That...
4
by: ron | last post by:
Hi, I have class object that i serialize using the System.Xml.Serialization class. Intermittently the object is not getting serialized correctly, using System.Xml.Serialization classes....
5
by: Arjen | last post by:
Hello, Can somebody help me a little bit? I can't get it to work. Please see my code below... I have placed some comments like "// And whats next?". I'm sure that I have to code something...
6
by: Uttam | last post by:
Hello, We are at a very crucial decision making stage to select between .Net and Java. Our requirement is to download a class at runtime on the client computer and execute it using remoting or...
6
by: Polo | last post by:
Hi, I have two public enums types each defined in a class (PolarDiagram and KDiagram) in a namespace (RTech.Graphic) I try to serialize this class with XmlSerializer without success A...
3
by: Paulo Morgado [MVP] | last post by:
Hi all ..NET Framework 1.1 I have created several types that are serailized to XML as strings. Someting like this: public struct MyInt32 : IXmlSerializable { int value;
5
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the...
2
by: Pawel | last post by:
Howto: Programmatically serialization Entry Method Parameters ( their values ) ? See example below: public static void C(string Code, string Name) {
0
by: JosAH | last post by:
Introduction Upon hearing the word, "Serialization", the first question which comes to mind is ... "What is Serialization?" We know that we can create resusable objects in Java. But the...
6
KevinADC
by: KevinADC | last post by:
This snippet of code provides several examples of programming techniques that can be applied to most programs. using hashes to create unique results static variable recursive function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.