Archive for June, 2008

C# XmlSerializer, Add an attribute to an array element

By admin - Last updated: Friday, June 27, 2008

In order words, add an attribute to an object element after xml serialization, If you want something like, <Rats count=“2″>   <Rat>little rat</Rat>   <Rat>old rat</Rat> </Rats> The C# code is [XmlType(“Rats”)]     public class Rats     {         [XmlAttribute(“count”)]         public int Count { get; set; [...]