Convert.ToBoolean Method (Object)
.NET Framework (current version)
Converts the value of a specified object to an equivalent Boolean value.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- value
-
Type:
System.Object
An object that implements the IConvertible interface, or null.
Return Value
Type: System.Booleantrue or false, which reflects the value returned by invoking the IConvertible.ToBoolean method for the underlying type of value. If value is null, the method returns false.
| Exception | Condition |
|---|---|
| FormatException | value is a string that does not equal TrueString or FalseString. |
| InvalidCastException | value does not implement the IConvertible interface. -or- The conversion of value to a Boolean is not supported. |
Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Show: