ToDouble Method (Boolean)

Convert.ToDouble Method (Boolean)

[ 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 Boolean value to the equivalent double-precision floating point number.

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

public static double ToDouble(
	bool value
)

Parameters

value
Type: System.Boolean
A Boolean value.

Return Value

Type: System.Double
The number 1 if value is true; otherwise, 0.

The following code sample illustrates the conversion of a Boolean value to a Double one, using ToDouble.


public void ConvertDoubleBool(double doubleVal)
{
   bool boolVal;
   // Double to bool conversion cannot overflow.
   boolVal = System.Convert.ToBoolean(doubleVal);
   outputBlock.Text += String.Format("{0} as a Boolean is: {1}.",
      doubleVal, boolVal) + "\n";

   // bool to double conversion cannot overflow.
   doubleVal = System.Convert.ToDouble(boolVal);
   outputBlock.Text += String.Format("{0} as a double is: {1}.",
      boolVal, doubleVal) + "\n";
}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft