Coffee, smoke and Techilicious Burps at 3.47 AM Headline Animator

Thursday, April 19, 2007

if you use xml formatter to serialize an object, would the private properties be serialized? What happens when you use a binary formatter?

XML Formatter does not serialize private properties. Serialization is the process of storing the state of an object into a persistence storage media and private properties are not serialized. Serialization has nothing to do with Private Properties.

When using Binary formatter, the private properties are serialized. Since it is a binary formatter, it just writes everything it reads from the object into the persistent storage media. Hence the private variables would also be persisted. But logically they should not be and using an XML Formatter is more advisable.

No comments: