By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,120 Members | 1,799 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,120 IT Pros & Developers. It's quick & easy.

Serializable()

P: n/a
<Serializable()Public Class Dealer

What does Serializable do?


Regards /Snedker
Sep 6 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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" <mo************@gmail.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
<Serializable()Public Class Dealer

What does Serializable do?


Regards /Snedker

Sep 6 '07 #2

P: n/a
thats what serialization does.

setting the Serializable attribute means the object will successfully
serialize if asked to. either the object implements ISerializable or
follows all the rules for the default serialization logic to work.

-- bruce (sqlwork.com)

Aidy wrote:
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" <mo************@gmail.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
><Serializable()Public Class Dealer

What does Serializable do?


Regards /Snedker

Sep 6 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.