XmlTypeAttribute.IncludeInSchema Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets a value that indicates whether to include the type in XML schema documents.

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

public bool IncludeInSchema { get; set; }

Property Value

Type: System.Boolean

true to include the type in XML schema documents; otherwise, false.

Apply the XmlTypeAttribute to a class to specify the XML type's namespace, the XML type name, and whether to include the type in the XML schema document. To see the results of setting the properties of the XmlTypeAttribute class, compile your application as an executable or DLL, and pass the resulting file to the XML Schema Definition tool (XSD.exe). The tool writes the schema, including the type definition.

The following example applies the XmlTypeAttribute to the ExtraneousInfo class, setting the IncludeInSchema property to false.

[XmlType(IncludeInSchema = false)]
public class ExtraneousInfo
   // Insert the members of the class.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top