Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Serialize Method (XmlWriter, Object, XmlSerializerNamespaces, String, String)

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)

member Serialize : 
        xmlWriter:XmlWriter * 
        o:Object * 
        namespaces:XmlSerializerNamespaces * 
        encodingStyle:string * 
        id:string -> unit


Type: System.Xml.XmlWriter

The XmlWriter used to write the XML document.

Type: System.Object

The object to serialize.

Type: System.Xml.Serialization.XmlSerializerNamespaces

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

Type: System.String

The encoding used in the document.

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft