ToBoolean Method (Double)

Convert.ToBoolean Method (Double)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Converts the value of the specified double-precision floating point number to an equivalent Boolean value.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Public Shared Function ToBoolean ( _
	value As Double _
) As Boolean

Parameters

value
Type: System.Double
A double-precision floating point number.

Return Value

Type: System.Boolean
true if value is not zero; otherwise, false.

The following code sample illustrates the use of the ToBoolean method, taking a Double as a parameter.


Public Sub ConvertDoubleBool(ByVal doubleVal As Double)
   Dim boolVal As Boolean

   'Double to Boolean conversion cannot overflow.
   boolVal = System.Convert.ToBoolean(doubleVal)
   outputBlock.Text &= String.Format("{0} as a Boolean is: {1}.", _
                             doubleVal, boolVal) & vbCrLf

   'Boolean to Double conversion cannot overflow.
   doubleVal = System.Convert.ToDouble(boolVal)
   outputBlock.Text &= String.Format("{0} as a Double is: {1}.", _
                             boolVal, doubleVal) & vbCrLf
End Sub


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft