共用方式為


IXmlSerializable Interface

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Provides custom formatting for XML serialization and deserialization to control how your object is serialized or deserialized by the XmlSerializer.

Namespace:  System.Xml.Serialization
Assembly:  System.Xml (in System.Xml.dll)

Syntax

'Declaration
Public Interface IXmlSerializable
public interface IXmlSerializable

The IXmlSerializable type exposes the following members.

Methods

  Name Description
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetSchema This method is reserved and should not be used. When implementing the IXmlSerializable interface, you should return a nulla null reference (Nothing in Visual Basic) reference (Nothing in Visual Basic) from this method.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ReadXml Generates an object from its XML representation.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 WriteXml Converts an object into its XML representation.

Top

Remarks

To control the serialization, implement the ReadXml() and WriteXml() methods to control the XmlReader and XmlWriter classes used to read and write the XML.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.