XName Widening Conversion (String to XName)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Converts a string formatted as an expanded XML name (that is,{namespace}localname) to an XName object.
Assembly: System.Xml.Linq (in System.Xml.Linq.dll)
Parameters
- expandedName
- Type: System.String
A string that contains an expanded XML name in the format {namespace}localname.
You are using this implicit operator when you create an XElement or XAttribute by passing a string to the appropriate constructor.
The following example creates an XName by assigning a string to it, which invokes this implicit conversion operator.
'add the following line to the the Imports section: 'Imports <xmlns="http://www.adventure-works.com"> Dim output As New StringBuilder Dim el As XElement = New XElement("{http://www.adventure-works.com}Root", "content") output.Append(el) output.Append(Environment.NewLine) ' The preferred approach is to import a global namespace and ' use an XML literal. Dim root As XElement = <Root>content</Root> output.Append(root) output.Append(Environment.NewLine) OutputTextBlock.Text = output.ToString()
Show: