XName.Get Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Include Protected Members
Include Inherited Members
Include Silverlight Members
Include Silverlight for Windows Phone Members
Include XNA Framework Members
Gets an XName object.
This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.
Overload List
Name | Description | |
---|---|---|
Get(String) | Gets an XName object from an expanded name. | |
Get(String, String) | Gets an XName object from a local name and a namespace. |
Top
Remarks
This method provides overloads that allow you to create an XName from a expanded XML name. You can create an XName from a string in the form {namespace}localname, or from a namespace and a local name, specified separately.
A much more common and easier way to create an XName is to use the implicit conversion from string. To create a name that is in a namespace, the common approach is to use the addition operator overload that allows you to combine an XNamespace object and a string.
For more information and examples, see How to: Create a Document with Namespaces (LINQ to XML) (C#).
For more information on using namespaces in Visual Basic, see Namespaces in Visual Basic (LINQ to XML).
Because XName objects are atomized, if there is an existing XName with exactly the same name, the assigned variable will refer to the existing XName. If there is no existing XName, a new one will be created and initialized.
See Also