示例:
public class Class1 : IDeserializationCallback { public DateTime Birthday { get; set; } [NonSerialized] public int Age; public void OnDeserialization(object sender) { Age = DateTime.Now.Year - Birthday.Year; } }
示例:
public class Class1 : IDeserializationCallback { public DateTime Birthday { get; set; } [NonSerialized] public int Age; public void OnDeserialization(object sender) { Age = DateTime.Now.Year - Birthday.Year; } }