, bool ShouldSerializeSomeDateTime() / , , , . , :
public string SomeDateTimeFormatted { get {return theField == DateTime.MinValue? ": theField.ToString(" R");}// set {... ...} }
It is better to stick with built-in serialization if you can, although partially, reduce the amount of code you need to write. Josh's assumption for null values DateTime (DateTime?) Is good, although it may not be completely empty-string vs formatted-string - I expect it to use xsi: nil markup.
source
share