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
try to use public bool ShouldSerialize_PropertyName_(){} with setting the default value inside.
public bool ShouldSerializeData() { Data = Data ?? ""; return true; }
Description of why this works can be found on MSDN.