TopicTransformationExtensions.ToBoolean Method
Definition
- Assembly
- Sandcastle.Core.dll
This converts an attribute value to a Boolean value. If not present, blank, or invalid, it returns false.
public static bool ToBoolean(this XAttribute attribute)
Parameters
attributeXAttributeThe attribute to convert
Returns
- bool
The attribute value if it is a Boolean or false if not
Remarks
Explicit casting of an attribute to bool or bool? works but if the value is
invalid or blank, the cast throws an exception. This will return false in those cases too.