开发者

XmlSerializer, deserializing time only into DateTime type

开发者 https://www.devze.com 2023-01-30 03:47 出处:网络
My WCF uses XmlSerializer to serialize and deserialize fairly complex objects.Problem is, the corresponding XML payload value of one of the DateTime开发者_Go百科 properties could be specified as eithe

My WCF uses XmlSerializer to serialize and deserialize fairly complex objects. Problem is, the corresponding XML payload value of one of the DateTime开发者_Go百科 properties could be specified as either xs:date, xs:time or xs:dateTime values. I've noticed that when a time-only value (e.g. 16:55:00Z) is specified in the input XML the current date gets 'prepended' during deserialization (e.g. 2010-12-13T16:55:00Z). This obviously creates false data, I would rather have preferred DateTime.MinValue. Is there a way I can control this behavior?

Thanks in advance


We use WCFDate to send the date part as xs:date.

See http://www.codeproject.com/Articles/182960/WCF-Support-for-xs-date for code.

0

精彩评论

暂无评论...
验证码 换一张
取 消