ElementName Property
Collapse the table of content
Expand the table of content

XmlRootAttribute.ElementName Property

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

Gets or sets the name of the XML element that is generated and recognized by the XmlSerializer class's Serialize and Deserialize methods, respectively.

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

public string ElementName { get; set; }

Property Value

Type: System.String
The name of the XML root element that is generated and recognized in an XML-document instance. The default is the name of the serialized class.

Specify an ElementName if you want the name of the generated XML element to differ from the class name.

The following example creates an instance of the XmlRootAttribute class and sets the ElementName property to a new value. The object is then used to create an XmlAttributeOverrides object used to override the serialization of an object.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2016 Microsoft