<PackageReference Include="System.Xml.XmlSerializer" Version="4.0.11-beta-23409" />

XmlSerializer

public class XmlSerializer
Serializes and deserializes objects into and from XML documents. The XmlSerializer enables you to control how objects are encoded into XML.
protected XmlSerializer()

Initializes a new instance of the XmlSerializer class.

public XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace)

Initializes a new instance of the XmlSerializer class that can serialize objects of type Object into XML document instances, and deserialize XML document instances into objects of type Object. Each object to be serialized can itself contain instances of classes, which this overload overrides with other classes. This overload also specifies the default namespace for all the XML elements and the class to use as the XML root element.

public XmlSerializer(Type type, XmlRootAttribute root)

Initializes a new instance of the XmlSerializer class that can serialize objects of the specified type into XML documents, and deserialize an XML document into object of the specified type. It also specifies the class to use as the XML root element.

public XmlSerializer(Type type, Type[] extraTypes)

Initializes a new instance of the XmlSerializer class that can serialize objects of the specified type into XML documents, and deserialize XML documents into object of a specified type. If a property or field returns an array, the extraTypes parameter specifies objects that can be inserted into the array.

public XmlSerializer(Type type, XmlAttributeOverrides overrides)

Initializes a new instance of the XmlSerializer class that can serialize objects of the specified type into XML documents, and deserialize XML documents into objects of the specified type. Each object to be serialized can itself contain instances of classes, which this overload can override with other classes.

public XmlSerializer(XmlTypeMapping xmlTypeMapping)

public XmlSerializer(Type type)

Initializes a new instance of the XmlSerializer class that can serialize objects of the specified type into XML documents, and deserialize XML documents into objects of the specified type.

public XmlSerializer(Type type, string defaultNamespace)

Initializes a new instance of the XmlSerializer class that can serialize objects of the specified type into XML documents, and deserialize XML documents into objects of the specified type. Specifies the default namespace for all the XML elements.

public static XmlSerializer[] FromMappings(XmlMapping[] mappings)

public static XmlSerializer[] FromMappings(XmlMapping[] mappings, Type type)

public static XmlSerializer[] FromTypes(Type[] types)

Returns an array of XmlSerializer objects created from an array of types.

public virtual bool CanDeserialize(XmlReader xmlReader)

Gets a value that indicates whether this XmlSerializer can deserialize a specified XML document.

public object Deserialize(Stream stream)

Deserializes the XML document contained by the specified Stream.

public object Deserialize(TextReader textReader)

Deserializes the XML document contained by the specified TextReader.

public object Deserialize(XmlReader xmlReader)

Deserializes the XML document contained by the specified XmlReader.

protected virtual object Deserialize(XmlSerializationReader reader)

public void Serialize(TextWriter textWriter, object o)

Serializes the specified Object and writes the XML document to a file using the specified TextWriter.

public void Serialize(TextWriter textWriter, object o, XmlSerializerNamespaces namespaces)

Serializes the specified Object and writes the XML document to a file using the specified TextWriter and references the specified namespaces.

public void Serialize(Stream stream, object o)

Serializes the specified Object and writes the XML document to a file using the specified Stream.

public void Serialize(Stream stream, object o, XmlSerializerNamespaces namespaces)

Serializes the specified Object and writes the XML document to a file using the specified Streamthat references the specified namespaces.

public void Serialize(XmlWriter xmlWriter, object o)

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

public void Serialize(XmlWriter xmlWriter, object o, XmlSerializerNamespaces namespaces)

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

protected virtual void Serialize(object o, XmlSerializationWriter writer)