XElement Constructor (XName)
Collapse the table of content
Expand the table of content

XElement Constructor (XName)

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

Initializes a new instance of the XElement class with the specified name.

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

public XElement(
	XName name
)

Parameters

name
Type: System.Xml.Linq.XName
An XName that contains the name of the element.

This constructor creates an element with no content and no attributes.

There is an implicit conversion from string to XName. Typical use of this constructor is to specify a string as the parameter instead of creating a new XName. When creating an element in a namespace, typical use is to use the addition operator overload with an XNamespace and a string to create an XName. For more information, see Working With Namespaces in the .NET Framework documentation.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft