0

MyValueisを使用して XML ファイルを0x0001逆シリアル化し、それを uint プロパティに逆シリアル化することは可能ですか? これを実装する最良の方法は何ですか?

public class MyClass
{
    private string myValue;
    public uint MyValue
    {
         //checkValue method checks if myValue is a decimal or hex and number (returns an uint value).

         get { return checkValue(myValue); } 
         set { myValue = value.ToString(); }

    }
}
4

1 に答える 1

0

次のようなものはどうですか:

public class MyClass
{
    private uint? _myValue;
    [XmlIgnore]
    public uint MyValue
    {
        get{ return _myValue ?? checkValue(MyValueString); }
        set{ _myValue = value; }
    }    

    [XmlElement("MyValue")]
    public string MyValueString
    {
         //checkValue method checks if myValue is a decimal or hex and number (returns an uint value).
         get; set;
    }
}
于 2013-01-14T10:40:16.980 に答える