XmlAttributes.XmlIgnore Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that specifies whether the XmlSerializer serializes a public field or public read/write property.

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

Syntax

'Declaration
Public Property XmlIgnore As Boolean
public bool XmlIgnore { get; set; }

Property Value

Type: System.Boolean
true if the XmlSerializer must not serialize the field or property; otherwise, false.

Remarks

By default, all public fields and public read/write properties are serialized by the XmlSerializer. That is, the value of each public field or property is persisted as an XML element or XML attribute in an XML-document instance.

To override the default serialization of a field or property, create an XmlAttributes object and set its XmlIgnore property to true. Add the object to an XmlAttributeOverrides object and specify the type of the object that contains the field or property to ignore and the name of the field or property to ignore.

If an XmlIgnoreAttribute is applied to a field or property, the field or property is ignored. However, you can override that behavior by creating an XmlAttributes object, setting its XmlIgnore property to false, and adding it to an XmlAttributeOverrides object that specifies the type of the object that contains the field or property and the name of the field or property.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.