Let's say I have something like:
[DataContract(Namespace="http://bla.bla")]
public class MyClass {
[DataMember] public long ResponseCode { get; set; }
[DataMember] public long Fee { get; set; }
}
and the following comes from the channel:
<ns0:MyResult>
<ns2:ResponseCode xmlns:ns2="http://bla.bla">101</ns2:ResponseCode>
<ns2:Fee xmlns:ns2="http://bla.bla"></ns2:Fee>
</ns0:MyResult>
I get an error message:
----> System.Xml.XmlException: value '' cannot be parsed as type 'Int64'. ----> System.FormatException: the input line was not in the correct format.
I do not understand why. The default value of the IsRequiredparameter IsRequired DataContractis equal false, so I expect it to be deserialized without errors and initialize the missing value with default values for the type (zero). What am I missing?
source
share