System.Xml.Serialization.XmlSerializer.Serialize Method

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

Syntax

public void Serialize (System.Xml.XmlWriter xmlWriter, object o, XmlSerializerNamespaces namespaces, string encodingStyle, string id)

Parameters

xmlWriter
The System.Xml.XmlWriter used to write the XML document.
o
The object to serialize.
namespaces
An instance of the XmlSerializaerNamespaces that contains namespaces and prefixes to use.
encodingStyle
The encoding used in the document.
id
For SOAP encoded messages, the base used to generate id attributes.

Remarks

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.

Requirements

Namespace: System.Xml.Serialization
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0