XName.LocalName Property

Definition

Gets the local (unqualified) part of the name.

C#
public string LocalName { get; }

Property Value

A String that contains the local (unqualified) part of the name.

Examples

The following example shows the use of this property.

C#
XNamespace ns = "http://www.adventure-works.com";
XElement root = new XElement(ns + "Root", "content");
Console.WriteLine(root.Name);
Console.WriteLine(root.Name.LocalName);
Console.WriteLine(root.Name.Namespace);

This example produces the following output:

{http://www.adventure-works.com}Root
Root
http://www.adventure-works.com

Remarks

This property is guaranteed to not be null.

Applies to

See also