I am using the XmlSerializer and have the following property in a class
public string Data { get; set; }
which I need to be output exactly like
I was recently doing this and there is an alternative way to do it, that seems a bit simpler. You just need to initialise the value of the property to an empty string then it will create an empty tag as you required;
Data = string.Empty;