Catel.Fody.XmlExtensions.ReadBool C# (CSharp) Method

ReadBool() public static method

public static ReadBool ( this config, string nodeName, Action setter ) : void
config this
nodeName string
setter Action
return void
        public static void ReadBool(this XElement config, string nodeName, Action<bool> setter)
        {
            var attribute = config.Attribute(nodeName);
            if (attribute != null)
            {
                bool value;
                if (bool.TryParse(attribute.Value, out value))
                {
                    setter(value);
                }
                else
                {
                    throw new WeavingException($"Could not parse '{nodeName}' from '{attribute.Value}'.");
                }
            }
        }
    }
XmlExtensions