CSharp examples for System.Xml:XML Attribute
Get As Boolean from XAttribute
using System.Xml.Linq; using System;/*from w w w .j a v a 2 s.com*/ public class Main{ #endregion #region GetAsBoolean Method public static bool GetAsBoolean(this XAttribute attr) { bool ret = false; bool value = false; if (attr != null && !string.IsNullOrEmpty(attr.Value)) { if (bool.TryParse(attr.Value, out value)) ret = value; } return ret; } }