I want to serialize my enum-value as an int, but i only get the name.
Here is my (sample) class and enum:
public class Request {
public RequestTy
Most of the time, people want names, not ints. You could add a shim property for the purpose?
[XmlIgnore]
public MyEnum Foo {get;set;}
[XmlElement("Foo")]
[EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
public int FooInt32 {
get {return (int)Foo;}
set {Foo = (MyEnum)value;}
}
Or you could use IXmlSerializable, but that is lots of work.