I'd like to have an enum attribute to be optional.
I guess the way to achieve that would be for it to be nullable.
[XmlAttribute(AttributeName = "action")]
public EAction? Action
{
get;
set;
}
But this won't work.
With my current knowledge on the matter the only valid nullable tpye I could use is string.
But if it's possible I'd rather not use the trick where you just hide the Enum with a string.
[XmlIgnore]
public EAction? Action
{
get;
set;
}
[XmlAttribute(AttributeName = "action")]
public string _Action
{
get { return this.Action.ToString();
set { ... }
}
Am I asking for the impossible?