The System.Runtime.Serialization namespace contains classes that can be used for serializing and deserializing objects.
Serialization is the process of converting an object or a graph of objects into a linear sequence of bytes for either storage or transmission to another location. Deserialization is the process of taking in stored information and re-creating objects from it.
Data Contract Classes
Two notable classes of this namespace are the DataContractAttribute and DataMemberAttribute attribute classes. Apply these attributes (to classes and class members, respectively) when creating Silverlight version 3 clients to specify which members of a class contain data that must be serialized. You can also apply the EnumMemberAttribute to enumeration members to control the XML generated. And apply the CollectionDataContractAttribute to collection classes to control the XML elements generated from collections.
Data Contract Serialization
Serialization without an Explicit Data Contract
Silverlight 3 also supports a simplified opt-out model for serialization, where these attributes can be omitted from the type and the members of the type to be serialized. The data contract is implicit in the sense that the visibility modifiers (public, private) used by the type determines whether it and its members are included in the data contract. In this model, the name of a member is used to identify it in the serialized representation. A new IgnoreDataMemberAttribute attribute can be used to opt-out a member that is public when required.
For more information about
serialization with an explicit data contract, see
Silverlight Serialization.
|
| Structure | Description |
|---|
.gif) | StreamingContext | Describes the source and destination of a given serialized stream, and provides an additional caller-defined context. |
Reference