The XML Schema Part 2 specifies that an instance of a datatype that is defined as boolean can have the following legal literals {true, false, 1, 0}. The following XML, for e
You can also do this by using some XmlSerializer attribute black magic:
[XmlIgnore]
public bool MyValue { get; set; }
/// Get a value purely for serialization purposes
[XmlElement("MyValue")]
public string MyValueSerialize
{
get { return this.MyValue ? "1" : "0"; }
set { this.MyValue = XmlConvert.ToBoolean(value); }
}
You can also use other attributes to hide this member from intellisense if you're offended by it! It's not a perfect solution, but it can be quicker than implementing IXmlSerializable.