Share via


IXmlSerializable.WriteXml Method

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

Converts an object into its XML representation.

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

Syntax

'Declaration
Sub WriteXml ( _
    writer As XmlWriter _
)
void WriteXml(
    XmlWriter writer
)

Parameters

Remarks

The implementation you provide for this method should write out the XML representation of the object. Write sufficient information to the XmlWriter stream to allow the ReadXml() method to reconstitute your object. For example, if your object state includes an array variable, be sure to write the length of the array, or use a parent element to contain the elements that describe the array values, so that you know how many values to read when the object is reconstituted.

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.