XmlSerializer.Serialize Method (Object, XmlSerializationWriter)

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

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Serializes the specified Object and writes the XML document to a file using the specified XmlSerializationWriter.

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

Syntax

'Declaration
Protected Overridable Sub Serialize ( _
    o As Object, _
    writer As XmlSerializationWriter _
)
protected virtual void Serialize(
    Object o,
    XmlSerializationWriter writer
)

Parameters

Exceptions

Exception Condition
NotImplementedException

Any attempt is made to access the method when the method is not overridden in a descendant class.

Remarks

Platform Notes

Silverlight for Windows Phone Silverlight for Windows Phone

 The XmlSerializer.Serialize method throws an InvalidOperationException if the XmlSerializer object is initialized with a type parameter that contains an array of objects of type XElement.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

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