When I recently studied remoting and Web services, I always saw an important word "serialization".
So what is serialization?
I was a blur before.
In order to find out, please come with me to serialize the journey of learning.
Let's take a look at the definition of serialization, and here's what Microsoft says:
Serialization can be defined as the process of storing the state of an object in a storage medium. In this procedure, both the public and private fields of the object and the name of the class, including the assembly that contains the class, are converted to a byte stream and then written to the data flow. When you deserialize the object later, you create an exact copy of the original object
Serialization is generally used in 2 different places:
1. Keep the data in storage
For example: I know the application of serialization and deserialization in. Net in asp.net forums
In forums, some of the content is not fixed, if the user data, in addition to some basic information, may also want MSN, Personal homepage, signature and so on. We are generally a property corresponding to a field in the table, if we add some new attributes, we have to increase the table field, but also modify the stored procedures, so it is not trouble?
In asp.net forums, the user data is serialized into 2, which solves the problem with a table field and has good scalability.
2. Send an object from one application domain to another by value
Remoting and Web services are typical applications
It's no use saying much, let's take a piece of code