XmlText Property

XmlAttributes.XmlText Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets an object that instructs the XmlSerializer to serialize a public field or public read/write property as XML text.

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

public XmlTextAttribute XmlText { get; set; }

Property Value

Type: System.Xml.Serialization.XmlTextAttribute
An XmlTextAttribute that overrides the default serialization of a public property or field.

By default, a public field or public read/write property is serialized as an XML element by the XmlSerializer. However, it can force the field or property to be serialized as XML text by applying an XmlTextAttribute to the field or property.

NoteNote:

The XmlTextAttribute cannot be applied to a field or property that returns an array.

To override the default serialization of a field or property (that does not return an array), create an XmlTextAttribute and assign it to the XmlText property of an XmlAttributes object. Add the XmlAttributes object to an XmlAttributeOverrides object and specify the type of the object that contains the overridden field or property and the name of the overridden field or property.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft