http://en.wikipedia.org/wiki/Serialization
.NET Framework
In the .NET languages, classes can be serialized and deserialized by adding the Serializable
attribute to the class.
If new members are added to a serializable class, they can be tagged with the OptionalField
attribute to allow previous versions of the object to be deserialized without error. This attribute affects only deserialization, and prevents the runtime from throwing an exception if a member is missing from the serialized stream. A member can also be marked with the NonSerialized
attribute to indicate that it should not be serialized. This will allow the details of those members to be kept secret.
To modify the default deserialization (for example, to automatically initialize a member marked NonSerialized
), the class must implement theIDeserializationCallback
interface and define the IDeserializationCallback.OnDeserialization
method.
Objects may be serialized in binary format for deserialization by other .NET applications. The framework also provides the SoapFormatter
and XmlSerializer
objects to support serialization in human-readable, cross-platform XML.
留言列表