Convert.ToBoolean Method

Definition

Converts values to Boolean structures.

Overloads

ToBoolean(Object)

This API supports the product infrastructure and is not intended to be used directly from your code.

Converts the specified Object to a Boolean.

ToBoolean(Object, Boolean)

This API supports the product infrastructure and is not intended to be used directly from your code.

Converts the specified Object value to a Boolean structure, optionally allowing data loss.

ToBoolean(Double)

This API supports the product infrastructure and is not intended to be used directly from your code.

Converts the specified Double to a Boolean.

ToBoolean(Object)

Converts the specified Object to a Boolean.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 static bool ToBoolean(System::Object ^ value);
public static bool ToBoolean (object value);
static member ToBoolean : obj -> bool
Public Shared Function ToBoolean (value As Object) As Boolean

Parameters

value
Object

The value to convert.

Returns

value converted to a Boolean.

Applies to

ToBoolean(Object, Boolean)

Converts the specified Object value to a Boolean structure, optionally allowing data loss.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 static bool ToBoolean(System::Object ^ value, bool explicitConversion);
public static bool ToBoolean (object value, bool explicitConversion);
static member ToBoolean : obj * bool -> bool
Public Shared Function ToBoolean (value As Object, explicitConversion As Boolean) As Boolean

Parameters

value
Object

The value to convert.

explicitConversion
Boolean

true to allow data loss; otherwise, false.

Returns

value converted to a Boolean.

Applies to

ToBoolean(Double)

Converts the specified Double to a Boolean.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 static bool ToBoolean(double d);
public static bool ToBoolean (double d);
static member ToBoolean : double -> bool
Public Shared Function ToBoolean (d As Double) As Boolean

Parameters

d
Double

The value to convert.

Returns

false if d is 0; otherwise, true.

Applies to