Your property should be nullable. The XML is explicitly telling you that the property can be either true
, false
, or null
; the 3 are valid values and your class should support all 3.
You don't need to do anything other than making your property a bool?
; the XmlSerializer
will properly handle reading/writing the i:nil="true"
when the property is null
.
Just make sure that your code is designed to account for the null
values where applicable so you don't get exceptions.