I have a class designed to perform like an UInt16. So instead of doing: UInt16 myProp, I can use Address myProp, which is more descriptive.
Here's a snippet:
public class Address
{
public UInt16 address { get; set; }
private static UInt16 add;
public static implicit operator UInt16(Address address)
{
return add;
}
public static implicit operator Address(UInt16 i)
{
Address temp = new Address(i);
return temp;
}
public Address(UInt16 value)
{
address = value;
add = value;
}
public Address() { }
}
Then I have a property: public Address myAddress { get; set; }
The rest of the code works perfectly.
This class need to be serialized and de-serialized as xml.
After serialization, I have in my xml
<myAddress>
<address>7</address>
</myAddress>
But after I desterilized the xml file, I cannot get myAddress property back to 7.
Maybe a weird question... any idea?