XmlSerializer Constructor (Type, XmlRootAttribute)
May 11, 2014
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.
Assembly: System.Xml.Serialization (in System.Xml.Serialization.dll)
The root element of an XML document encloses all the other elements. By default, the object specified by the type parameter is serialized as the root element. Properties, such as the XML element name of the root element, are taken from the type object. However, the root parameter allows you to replace the default object's information by specifying an XmlRootAttribute. The object allows you to set a different namespace, element name, and so on.