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 is coming from a 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'm getting the error:
----> System.Xml.XmlException : The value '' cannot be parsed as the type 'Int64'. ----> System.FormatException : Input string was not in a correct format.
I don't understand why. The default value of IsRequired
parameter of DataContract
is false
so i expect it to deserialize without errors and initialize the missing value with default values for the type (zero). What am i missing?