Value.AsBool Property
Gets the boolean representation of this value.
public bool AsBool { get; }
Remarks
This method will attempt to convert the value to a number, if it isn’t already. The conversion is done in the following ways:
-
If the value is a string, it will return
true
if the string is not empty. -
If the value is a number, it will return
true
if the value is non-zero, andfalse
otherwise. -
If the value is
null
, it will returnfalse
.
Exceptions
Exception | Description |
---|---|
InvalidOperationException |
Thrown when the underlying value cannot be converted to a bool . |
Source
Defined in YarnSpinner/Value.cs, line 141.