M
Morten Snedker
<Serializable()> Public Class Dealer
What does Serializable do?
Regards /Snedker
What does Serializable do?
Regards /Snedker
It allows another object to convert your object's properties into a form
that can be transmitted, saved etc and then re-created. As an object is
basically a bunch of binary data you can't do much with it beyond your
existing app.
Marking your object as serialisable means it can be stored in the viewstate,
stored in the session if you're not using in-proc sessions, can be sent via
remoting, web methods etc. What happens is that the object's data is stored
in a property bag type thing, that property bag is saved somewhere
(viewstate, session etc) or sent (remoting etc) then the receiving code will
deserialise the object by creating a new instance of one and setting its
properties as dictated by the property bag. So in psuedo code;
//Take object's property values and store in the viewstate
ViewState ["myObject"] = myObject;
// Create new instance of object, read the property values are read from the
viewstate
// and populate the new object with them
myObject = (MyObjectType) ViewState["myObject"];
The two objects *look* the same as they have the same property values, but
they are not the actual same binary object.
Morten Snedker said:<Serializable()> Public Class Dealer
What does Serializable do?
Regards /Snedker
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.