I find the answer here: Xmlserializer - Control Element-Attribute Pairing (revised).
Here is how to do it: mark the value property with the [XmlText]
attribute.
public class Quantity {
// your attributes
[XmlAttribute]
public string foo;
[XmlAttribute]
public string bar;
// and the element value (without a child element)
[XmlText]
public int qty;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With