TopicTransformationExtensionsToBoolean Method
This converts an attribute value to a Boolean value. If not present, blank, or invalid, it
returns false.
Namespace: Sandcastle.Core.PresentationStyle.TransformationAssembly: Sandcastle.Core (in Sandcastle.Core.dll) Version: 2024.9.12.0
public static bool ToBoolean(
this XAttribute attribute
)
<ExtensionAttribute>
Public Shared Function ToBoolean (
attribute As XAttribute
) As Boolean
public:
[ExtensionAttribute]
static bool ToBoolean(
XAttribute^ attribute
)
[<ExtensionAttribute>]
static member ToBoolean :
attribute : XAttribute -> bool
- attribute XAttribute
- The attribute to convert
BooleanThe attribute value if it is a Boolean or false if notIn Visual Basic and C#, you can call this method as an instance method on any object of type
XAttribute. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
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.