Create an XElement from tag name and XAttribute array value in CSharp
Description
The following code shows how to create an XElement from tag name and XAttribute array value.
Example
/*from ww w .ja v a 2s . c o m*/
using System;
using System.Linq;
using System.Xml.Linq;
public class MainClass{
public static void Main(){
XElement root;
XAttribute[] attArray = {
new XAttribute("NewAtt1", 1),
new XAttribute("NewAtt2", 2),
new XAttribute("NewAtt3", 3)
};
root = new XElement("Root", attArray);
Console.WriteLine(root);
}
}