Create XAttribute with namespace in CSharp
Description
The following code shows how to create XAttribute with namespace.
Example
/*w w w . ja v a 2s. c om*/
using System;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass{
public static void Main(){
XNamespace aw = "http://www.domain.com";
XElement root = new XElement(aw + "Root",new XAttribute(aw + "AnAttributeName", "Content"));
Console.WriteLine(root);
}
}