ToString Method
Collapse the table of content
Expand the table of content

XAttribute.ToString Method

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

Converts the current XAttribute object to a string representation.

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

'Declaration
Public Overrides Function ToString As String

Return Value

Type: System.String
A String containing the XML text representation of an attribute and its value.

This method returns a string in the form of AttributeName="content".

The following example creates an element with several attributes. It then gets an attribute and displays it and its content by calling this method.


Dim output As New StringBuilder
Dim root As XElement = <Root Att1="content1" Att2="content2" Att3="content3"/>
Dim att As XAttribute = root.Attribute("Att2")
output.Append(att.ToString())
output.Append(Environment.NewLine)

OutputTextBlock.Text = output.ToString()


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft