
Allows the XmlSerializer to recognize a type when it serializes or deserializes an object.
Assembly: System.Xml (in System.Xml.dll)
Use the XmlIncludeAttribute when you call the Serialize or Deserialize method of the XmlSerializer class.
When applying the XmlIncludeAttribute, specify the Type of the derived class. When the XmlSerializer serializes objects that include both the base and the derived class, it can then recognize both object types.
You can use the XmlIncludeAttribute to include derived classes in service description documents that are written in the Web Services Description Language (WSDL). For example, if a method returns an Object, apply the XmlIncludeAttribute to the method and specify the actual types to return.
For more information on the WSDL, see "Web Services Description Language (WSDL) 1.1" at www.w3.org.
The following example shows three classes, two of which inherit from the third. The example applies the XmlIncludeAttribute to a method that returns an instance of one of the derived classes.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.