public static ReadBool ( this config, string nodeName, Action |
||
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}'.");
}
}
}
}