Sarah_Maine
New Member
I have a list inside another list(product with variants). I would like the parent list to have attributes set on it. Just an id and a name. Here is the desired outputDesired Output\[code\]<embellishments> <type id="1" name="bar bar foo"> <row> <id>1</id> <name>foo bar</name> <cost>10</cost> </row> </type> </embellishments>\[/code\]Current Code\[code\][XmlRoot( ElementName = "embellishments", IsNullable = false )]public class EmbellishmentGroup{ [XmlArray(ElementName="type")] [XmlArrayItem("row", Type=typeof(Product))] public List<Product> List { get; set; } public EmbellishmentGroup() { List = new List<Product>(); List.Add( new Product() { Id = 1, Name = "foo bar", Cost = 10m } ); }}public class Product{ [XmlElement( "id" )] public int Id { get; set; } [XmlElement( "name" )] public string Name { get; set; } [XmlElement( "cost" )] public decimal Cost { get; set; }}\[/code\]Current Output\[code\]<embellishments> <type> <row> <id>1</id> <name>foo bar</name> <cost>10</cost> </row> </type></embellishments>\[/code\]