11.1 What Is Serialization?

Some types are like mosquitoes: once instantiated , they live a short life near to where they were born, and then die quietly . Types such as these don't store important nontransient data and are used by clients in the same context they were created in. These types are trivial, and generally don't need serialization. However, many important types are not like this, storing data that needs to be persisted to some backing store (e.g. a database, file, or network), or being passed back and forth between different contexts as parameters in method calls. These types need to support serialization.

Serialization is the act of taking an in-memory object or object graph and flattening it into a stream of bytes that may be stored or transmitted. Deserialization works in reverse, taking a stream of bytes and reconstituting it into an in-memory object instance or object graph. Serialization and deserialization can happen either explicitly or implicitly, but the basic mechanism remains the same.



C# in a Nutshell
C # in a Nutshell, Second Edition
ISBN: 0596005261
EAN: 2147483647
Year: 2005
Pages: 963

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net