Serializes the specified object and writes the XML document to a file using the specified System.IO.TextWriter.
- textWriter
- The System.IO.TextWriter used to write the XML document.
- o
- The object to serialize.
The XmlSerializer.Serialize(System.IO.TextWriter, object) method converts the public fields and read/write properties of an object into XML. It does not convert methods, indexers, private fields, or read-only properties. To serialize all an object's fields and properties, both public and private, use the System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.
In the textWriter parameter, specify an object that derives from the abstract System.IO.TextWriter class. Classes that derive from System.IO.TextWriter include:
The System.Xml.Serialization.XmlSerializer cannot serialize the following: arrays of ArrayList and arrays of List`1.