Add XAttribute array to XElement
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()
{
XElement root;
double dbl = 12.345;
XAttribute[] attArray = {
new XAttribute("Att4", 1),
new XAttribute("Att5", 2),
new XAttribute("Att6", 3)
};
DateTime dt = new DateTime(2006, 10, 6, 12, 30, 00);
root = new XElement("Root",
new XAttribute("Att1", "Some text"),
new XAttribute("Att2", dbl),
new XAttribute("Att3", dt),
attArray
);
Console.WriteLine(root);
}
}
Related examples in the same category