Mega Code Archive

 
Categories / C# Tutorial / XML LINQ
 

Namespace Construction

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Xml.Linq;     public class MainClass     {         public static void Main()         {             XNamespace ns = "A";             XElement root = new XElement(ns + "employee",                                 new XElement(ns + "firstname","aaa"),                                 new XElement(ns + "lastname","bbb")                                 );             root.SetAttributeValue("xmlns", ns);             //root.SetAttributeValue(XNamespace.Xmlns + "your value", ns);             Console.WriteLine(root.ToString());         }     }