c# - How do I get a DataMemberAttribute use a boolean type -


I have a simple test app that lets XML doctors pull from a comfortable interface. There are some string fields and some boolean fields in the data element. I create a simple unit class and put a DataContractAttribute on it and then added DataMemberAttributes to each data member. I then use HttpResponseMessage.Content.ReadAsDataContract () to analyze the response. All string types come through just fine but all my Boolean types are false (and they are not really wrong) The XML element is something like this:

  & lt; Has-enabled type = "boolean" & gt; True & lt; / Is-enabled & gt;  

And then in my type class I have something like this:

  [datamember (name = "is-enabled")] Public Child is enabled { Get back to it } Set {this.isEnabledField = value; }}  

How do I get the boolean values ​​properly?

Whether or not to believe it, the data controller is sensitive to the sequence of elements of XRML, which can be deserialized Used to be. I am sure that you have to set the OrderMetaTit's Order Property to match the actual status of "Enabled" for other children of your original element.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -