Share via


XmlAttributes.XmlArray Property

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

Gets or sets an object that specifies how the XmlSerializer serializes a public field or read/write property that returns an array.

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

Syntax

'Declaration
Public Property XmlArray As XmlArrayAttribute
public XmlArrayAttribute XmlArray { get; set; }

Property Value

Type: System.Xml.Serialization.XmlArrayAttribute
An XmlArrayAttribute that specifies how the XmlSerializer serializes a public field or read/write property that returns an array.

Remarks

There are two ways in which a public field or public read/write property that returns an array is serialized by the XmlSerializer: the default serialization and the controlled serialization.

In the default serialization, no attribute is applied to the member. When serialized, the array is serialized as a nested sequence of XML elements with the XML element name of the nested sequence taken from the member name.

To control the serialization more precisely, apply an XmlArrayAttribute to the field or property. For example, you can change the generated XML element name from the default to a different name by setting the ElementName property to a new value.

The XmlArray property allows you to override the default serialization, as well as the serialization controlled by applying an XmlArrayAttribute to the member. For example, you can change the XML element name generated from the default (the member identifier) to a new value. In addition, if you apply an XmlArrayAttribute to a member, it is overridden by any XmlArrayAttribute that is assigned to the XmlArray 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.