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
Based on another stack overflow question you can do:
public class MySerilizedObject
{
[XmlIgnore]
public bool BadBoolField { get; set; }
[XmlElement("BadBoolField")]
public string BadBoolFieldSerialize
{
get { return this.BadBoolField ? "True" : "False"; }
set
{
if(value.Equals("True"))
this.BadBoolField = true;
else if(value.Equals("False"))
this.BadBoolField = false;
else
this.BadBoolField = XmlConvert.ToBoolean(value);
}
}
}