Why can DateTime.MinValue not be serialized in timezones ahead of UTC?

后端 未结 7 1019
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-24 02:09

I am experiencing issues with a WCF REST service. The wire object that I try to return has certain properties not set, resulting in DateTime.MinValue for properties of type

7条回答
  •  一个人的身影
    2020-12-24 02:27

    Try to add this on any DateTime Member

    [DataMember(IsRequired = false, EmitDefaultValue = false)]
    

    Most of these erros happens because the default value of the datetime is DateTime.MinValue which is from year of 1 and the JSON serialization is from year 1970.

提交回复
热议问题