Method ToBoolean
ToBoolean()
Converts value of this instance to boolean.
Declaration
public virtual bool ToBoolean()
Returns
Type | Description |
---|---|
Boolean | Value of this instance as boolean. |
Remarks
This conversion is valid only for instances of
BooleanValue or instances of
StringValue with values "true" or "false", ignoring
case and leading/trailing whitespace (see
ToBoolean(String)).
Exceptions
Type | Condition |
---|---|
InvalidCastException | If this instance is not BooleanValue or StringValue. |
FormatException | If this instance is StringValue and does not have value "true" or "false". |