Serializes the specified object and writes the XML document to a file using the specified System.IO.Streamthat references the specified namespaces.
- stream
- The System.IO.Stream used to write the XML document.
- o
- The object to serialize.
- namespaces
- The System.Xml.Serialization.XmlSerializerNamespaces referenced by the object.
When the XmlSerializer.Serialize(System.IO.TextWriter, object) method is invoked, the public fields and read/write properties of an object are converted into XML. Methods, indexers, private fields, and read-only properties are not serialized. To serialize all fields and properties, both public and private, use the System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.
Use the stream parameter to specify an object that derives from the abstract System.IO.Stream class, which is designed to write to streams. Classes that derive from the System.IO.Stream class include:
The System.Xml.Serialization.XmlSerializer cannot serialize the following: arrays of ArrayList and arrays of List`1.