Create XNamespace with string value
using System; using System.Linq; using System.Xml.Linq; using System.Collections.Generic; class Program//ww w.ja va 2 s .c o m { static void Main(string[] args){ XNamespace ns = "http://www.book2s.com/Books"; XElement xBook = new XElement(ns + "Book"); Console.WriteLine(xBook); } }