CSharp examples for System.Xml:XML Attribute
Get XML Bool Attribute
using System.Xml; public class Main{ public static bool GetBoolAttribute(this XmlNode node, string key, bool defaultValue) {//from www . jav a 2 s.c om XmlAttributeCollection attributes = node.Attributes; bool val = defaultValue; if (attributes[key] != null && !string.IsNullOrEmpty(attributes[key].Value)) { bool.TryParse(attributes[key].Value, out val); } return val; } }