I am serializing an XML document from a class like so:
<data>
<name></name>
<address></address>
<zip></zip>
....a whole bunch more elements
</data>
I would like it to look like this (add an id attribute to every single element):
<data id="">
<name id=""></name>
<address id=""></address>
<zip id=""></zip>
....a whole bunch more elements
</data>
How do I set up my class so that the id attribute is added to every single element in my XML? Now, I simply serialize my class properties which might look like so:
public class data
{
public string name {get; set;}
public string address {get; set;}
public string zip {get; set;}
}
From this example, it looks like I could make each property in my class return a type that contains the id attribute but I'd have to do that for all the properties which seems like overkill.