When to do property specific tasks after xml deserialization

66661337

New Member
I'm using XML deserialization to handle XML responses from an api I'm calling. One of the properties I'm getting back needs to be changed depending on another property in the class. An example:\[code\]<XmlRoot("Foot")> _Public Class Foo Private m_bar1 As String Private m_bar2 As String Private m_rawbar2 As String <XmlAttribute("Bar1")> _ Public Property Bar1() As String Get return m_bar1 End Get Set(value As String) m_bar1 = value End Set End Property <XmlAttribute("Bar2")> _ Public Property RawBar2() As String Get return m_rawbar2 End Get Set(value As String) m_rawbar2= value 'This won't (always) work because the order in which the 'properties are deserialized is unknown 'm_bar2 = m_bar1 & m_rawbar2 End Set End Property <XmlIgnore()> _ Public ReadOnly Property Bar2() As String Get return m_bar2 End Get End PropertyEnd Class\[/code\]In my case bar1 would be an url and bar2 would be a relative path on the same domain. The only time I can set m_bar2 would be when every property is deserialized since the order is unknown. What would be the best way to do this?
 
Back
Top