1、让我们来看看使用JavaScriptSerializer类序列化日期会出现什么问题?
1)创建用于序列化的测试类,如下:
1 public class Person 2 { 3 public int ID { get; set; } 4 public string Name { get; set; } 5 public DateTime Birthday { get; set; } 6 7 // 重写ToString方法是为了方便查看结果 8 public override string ToString() 9 { 10 return string.Format("ID:{0};Name:{1};Birthday:{2}", this.ID, this.Name, this.Birthday); 11 } 12 }