XmlSerializer Constructor (Type, Type)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
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 a specified type. If a property or field returns an array, the extraTypes parameter specifies objects that can be inserted into the array.
Assembly: System.Xml.Serialization (in System.Xml.Serialization.dll)
By default, if a public property or field returns an object or array of objects, the object types are automatically serialized. However, if a class contains a field or property that returns an array of type Object, any object can be inserted into that array. In that case, the XmlSerializer must be instructed to expect all the possible object types that are inserted into the Object array. To do this, use the extraTypes parameter to specify the extra object types to serialize or deserialize.
You can also use the extraTypes parameter to specify types derived from a base class. For example, suppose a base class named Phone exists and a class named InternationalPhone derives from it. Use the extraTypes parameter to specify the derived type as well.