I want to build the following XML node from a class.
<Foo id="bar">some value</Foo>
How should my class definition be?
class Foo
{
public string Value {set;get;}
public string id{set;get;}
}
I believe i should put some XML attributes to these properties but not sure what they are.
Take a look at the attributes under the System.Xml.Serialization namespace for that. In your case, the class should look like the code below.
Update: added code to serialize the type.