Get Namespace from XElement in CSharp
Description
The following code shows how to get Namespace from XElement.
Example
// w w w.ja v a2s.com
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
public class MainClass
{
public static void Main()
{
XElement root = XElement.Load(Application.StartupPath + @"\employees.xml");
Console.WriteLine(root.Name.NamespaceName);
Console.WriteLine(root.Name.LocalName);
Console.WriteLine(root.Name.ToString());
}
}