I\'m having an issue with deserializing an XML file with boolean values. The source XML files I\'m deserializing were created from a VB6 app, where all boolean values are c
I stumbled upon the same issue, and based on the answer by jman, I solved it this way:
[XmlIgnore]
public bool BadBoolField { get; set; }
[XmlAttribute("badBoolField")]
public string BadBoolFieldSerializable
{
get
{
return this.BadBoolField.ToString();
}
set
{
this.BadBoolField= Convert.ToBoolean(value);
}
}
Be aware this is not necessarily by XML / Serialization specification, but it works good and it can handle a widespread conversion values (i.e. string like "True", "true", if you would replace the constraint of being a string it could handle numbers as well).