XML Serialization: How to serialize a property with a null value without xsi:nill attribute?
I have a property the following code:
At the minute, when I serialize it I get:
But I want to get this:
What is the best way of achieving this? I do not want to do any post-processing such as
[Serializable()]
public class MyClass
{
[XmlElement(ElementName = "MyProperty")]
public decimal? MyProperty
{
get;
set;
}
}At the minute, when I serialize it I get:
<MyProperty xsi:nil="true" />But I want to get this:
<MyProperty />What is the best way of achieving this? I do not want to do any post-processing such as
myXML.Replace("xsi:nil="true"", "")