I have a class being serialized with the following property:
[XmlAttribute("Phone Number")]
public string PhoneNumber{ get; set; }
public bool ShouldSerializePhoneNumber()
{
return !string.IsNullOrEmpty(PhoneNumber);
}
However, if the Phone Number is left empty, it's still serializing it. (phonenumber="").
PhoneNumber is set to string.Empty when my object is being created. Is there a step I'm missing?