Object Serialization is a process through which an object's state is transformed into some serial data format, such as XML or binary format, in order to be stored for some later use. In other words, the object is "dehydrated" and put away until we need to use it again.
Some good uses for serialization/deserialization include:
- Storing user preferences in an object.
- Maintaining security information across pages and applications.
- Modification of XML documents without using the DOM.
- Passing an object from on application to another.
- Passing an object from one domain to another.
- Passing an object through a firewall as an XML string.
class Person
{
private String personName;
private Int32 personAge;
public String Name
{
get
{
return personName;
}
set
{
personName = value;
}
}
public Int32 Age
{
get
{
return personAge;
}
set
{
personAge = value;
}
}
}
Person oPerson = new Person();
oPerson.Name = "Sandeep Rauniyar";
oPerson.Age = 25;
we wanted to save a copy of this object just as it is at this very moment. We could serialize it as an XML document that would look something like this:
Sandeep Rauniyar
25
No comments:
Post a Comment