Get the namespace part of the fully qualified name in CSharp
Description
The following code shows how to get the namespace part of the fully qualified name.
Example
//from w w w . jav a 2 s .com
using System;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass{
public static void Main(){
XNamespace ns = "http://www.domain.com";
XElement root = new XElement(ns + "Root", "content");
Console.WriteLine(root.Name);
Console.WriteLine(root.Name.LocalName);
Console.WriteLine(root.Name.Namespace);
}
}