XElement Constructor (XName)
Microsoft Silverlight will reach end of support after October 2021. Learn more.
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)
Syntax
'Declaration
Public Sub New ( _
name As XName _
)
public XElement(
XName name
)
Parameters
- name
Type: System.Xml.Linq.XName
An XName that contains the name of the element.
Remarks
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.
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.
See Also