Is it possible to change the serialization format of DateTime.
Basically i want this DateTime output in my xml file after serialization:
yyyyMMddHHmmss
... and a proper DateTime value after deserialization.
You cant.
However, If you control both the serializer and the deserializer, you can use the [XmlIgnore]
attribute on the DateTime field, and create a custom property that formats (and parses) a string to the required format.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.