EmitDefaultValue=false only working for strings
问题 I am trying to serialize the following c# class to XML [DataContract] public class LatLonPoint { [DataMember(IsRequired = true, Order = 1)] public float Lat { get; set; } [DataMember(IsRequired = true, Order = 2)] public float Lon { get; set; } [DataMember(EmitDefaultValue = false, Order = 3)] public DateTime? OptimalTime { get; set; } } When I serialize this class using the following code public static string GetLatLonPointXml(LatLonPoint data) { XmlSerializer xmlSerializer = new