I am xml serializing an object and I cannot seem to change the order in which the fields are serialized.
I.e.
public class foo{
string a {get;set;}
string b {get;set;}
}
Comes out as (pseudocode)
<foo b="world" a="hello" />
When I need
<foo a="hello" b="world" />
Can anyone help?
If you cannot achieve this via decorating the class with XML attributes (which you cannot do if you require XML attributes instead of XML elements as output), you may need to implement IXmlSerializable yourself, mentioned briefly here:
custom xml serialization
And here:
Proper way to implement IXmlSerializable?
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