XElement to Boolean Cast
using System; using System.Linq; using System.Xml.Linq; using System.Collections; using System.Collections.Generic; public class MainClass{ public static void Main(){ XElement root = new XElement("Root", new XElement("BoolValue1", true), new XElement("BoolValue2", false) ); bool bool1 = (bool)root.Element("BoolValue1"); bool bool2 = (bool)root.Element("BoolValue2"); Console.WriteLine("(bool)BoolValue1={0}", bool1); Console.WriteLine("(bool)BoolValue2={0}", bool2); } }