I suggest exposing a new property for serialization (labeled DataMemberAttribute ) that uses the Ticks property of your original time.
For instance:
[DataMember("TheTimeSpanTicks")] public long TheTimeSpanTicks { get { return TheTimeSpan.Ticks; } set { TheTimeSpan = new TimeSpan(value); } }
I'm not sure what the requirements for accessing serialization will be. Perhaps you could use protected instead of public .
source share