CSharp examples for System.Xml:XML Attribute
Get Bool Attr
using System.Xml.Linq; using System;// w w w . jav a2s . c o m public class Main{ public static bool GetBoolAttr(this XElement elem, string name) { bool.TryParse(elem.GetAttrValue(name), out var v); return v; } public static string GetAttrValue(this XElement elem, string attrName) { return elem.Attribute(attrName)?.Value; } }