Take for example:
-
new XAttribute("Completed", true)
-
studentElement.SetAttributeValue("Included", studentItem.Type != string.Empty);
In both instances, the resulting XML file will have ether "true
or "false"
. Is it possible to set up the XDocument
so that all bool
attribute values are saved as 0
and 1
respecively?
I know I can do:
-
new XAttribute("Completed", "1")
-
studentElement.SetAttributeValue("Included", studentItem.Type != string.Empty ? "1" : "0");
Is there a simple alternative?
I am using Load
and Save
to read / write to XML file (XDocument
).