Click or drag to resize
ConvertToBoolean Method (Object)
Converts the value of a specified object to an equivalent Boolean value.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static bool ToBoolean(
	Object value
)

Parameters

value
Type: SystemObject
An object that implements the IConvertible interface, or null.

Return Value

Type: Boolean
true or false, which reflects the value returned by invoking the ToBoolean(IFormatProvider) method for the underlying type of value. If value is null, the method returns false.
Exceptions
ExceptionCondition
FormatExceptionvalue is a string that does not equal TrueString or FalseString.
InvalidCastExceptionvalue does not implement the IConvertible interface.-or-The conversion of value to a Boolean is not supported.
See Also