Provides the base class used to serialize objects as XML streams or documents. This class is abstract.
Assembly: System.Runtime.Serialization (in System.Runtime.Serialization.dll)
Extend the to create your own serializer to serialize and deserialize objects. Both the DataContractSerializer class and the NetDataContractSerializer class inherit from the and are used to serialize and deserialize objects that conform to data contract rules (objects created using the DataContractAttribute and the DataMemberAttribute).Notes to Inheritors:
When you inherit from , you must override the following members: XmlObjectSerializer.WriteStartObject(XmlDictionaryWriter, Object), XmlObjectSerializer.WriteObjectContent(XmlDictionaryWriter, Object), XmlObjectSerializer.WriteEndObject(XmlDictionaryWriter). Additionally, the IsStartObject and ReadObject methods must be implemented for reading and deserializing.
The following example shows a method named WriteObjectWithInstance that includes an as a parameter. The method serializes an object using either the DataContractSerializer or NetDataContractSerializer by calling the WriteObject method.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.