cjard
Well-known member
- Joined
- Apr 25, 2006
- Messages
- 7,081
- Programming Experience
- 10+
Suppose we have the XML:
And the code:
(maybe there's c# convention in there, please excuse)
Howcome the xml is parsed into a timespan of 0?
If I made the code read and write a string, then it picks up the string of 00:02 from the xml ok.. and I can parse this intoa timespan in my Set clause, but I'm wondering how i make the serializer generator parse the 00:02 into a timespan straight off the bat..
VB.NET:
<root>
<ts>00:02</ts>
</root>
And the code:
VB.NET:
[XmlRoot("root")] _
[Serializable]
Public Class Root
Private TimeSpan ts = TimeSpan.FromHours(23) 'default
[XmlElement("ts")]
Public Property TS
Get
Return ts;
End Get
Set
ts = value;
End Set
End Property
End Class
(maybe there's c# convention in there, please excuse)
Howcome the xml is parsed into a timespan of 0?
If I made the code read and write a string, then it picks up the string of 00:02 from the xml ok.. and I can parse this intoa timespan in my Set clause, but I'm wondering how i make the serializer generator parse the 00:02 into a timespan straight off the bat..