Expand
XmlIncludeAttribute Class

Allows the XmlSerializer to recognize a type when it serializes or deserializes an object.

Namespace:  System.Xml.Serialization
Assembly:  System.Xml (in System.Xml.dll)
Syntax

'Declaration

<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Method Or AttributeTargets.Interface, AllowMultiple := True)> _
Public Class XmlIncludeAttribute _
	Inherits Attribute
Remarks

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.

Examples

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.

This language is not supported or no code example is available.
Inheritance Hierarchy

System.Object
  System.Attribute
    System.Xml.Serialization.XmlIncludeAttribute
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms

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.
Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Community ContentAdd
Page view tracker