This documentation is archived and is not being maintained.

XmlSerializer.Serialize Method (XmlWriter, Object, XmlSerializerNamespaces, String, String)

Serializes the specified Object and writes the XML document to a file using the specified XmlWriter, XML namespaces, and encoding.

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

public void Serialize(
	XmlWriter xmlWriter,
	Object o,
	XmlSerializerNamespaces namespaces,
	string encodingStyle,
	string id
)

Parameters

xmlWriter
Type: System.Xml.XmlWriter

The XmlWriter used to write the XML document.

o
Type: System.Object

The object to serialize.

namespaces
Type: System.Xml.Serialization.XmlSerializerNamespaces

An instance of the XmlSerializaerNamespaces that contains namespaces and prefixes to use.

encodingStyle
Type: System.String

The encoding used in the document.

id
Type: System.String

For SOAP encoded messages, the base used to generate id attributes.

The id parameter supplies the base string used to create SOAP ids. By default, these are "id1", "id2" and so on. But if the parameter is set to "myBase" the generated values are "myBaseid1", "myBaseid2" and so on. This functionality is used to create unique id values across the whole SOAP message.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: