JavaScriptSerializer序列化次数不一致

时间:2016-08-12 10:06:21

标签: c# json datetime

两个日期时间进入JavaScriptSerializer,两者都有DateTimeKind.Unspecified

一个人落后一小时。如何让两个日期连续排序?

输入JavaScriptSerializer.Serialize():

 [DataMember]
 public DateTime? CoverStartDate { get; set; }

 [DataMember]
 public DriverInfo[] Drivers { get; set; }

 public class DriverInfo : IDriverInfo
 {
     [DataMember]
     public DateTime? DateOfBirth { get; set; }
 }

enter image description here

JavaScriptSerializer.Serialize()的输出:

{"SiteId":24,"RegionId":2,"SchemeId":null,"SchemeTypeId":null,"IsAnnual":null,"Drivers":[{"DisplayIndex":0,"Title":null,"FirstName":null,"LastName":null,"Age":51,"DateOfBirth":"\/Date(-155001600000)\/","IsLeadDriver":true}],"CoverStartDate":"\/Date(1471042800000)\/","TripDuration":15}

enter image description here

如何使两个DateTimes一致地序列化?

0 个答案:

没有答案