ToDouble Method (Byte)
This documentation is archived and is not being maintained.

# Convert.ToDouble Method (Byte)

.NET Framework 1.1

Converts the value of the specified 8-bit unsigned integer to the equivalent double-precision floating point number.

```[Visual Basic]
Overloads Public Shared Function ToDouble( _
ByVal value As Byte _
) As Double
[C#]
public static double ToDouble(
byte value
);
[C++]
public: static double ToDouble(
unsigned char value
);
[JScript]
public static function ToDouble(
value : Byte
) : double;```

#### Parameters

value
An 8-bit unsigned integer.

#### Return Value

The double-precision floating point number equivalent to the value of value.

#### Example

[Visual Basic, C#, C++] The following code sample illustrates the conversion of a Byte value to a Double one, using ToDouble.

```[Visual Basic]
Public Sub ConvertDoubleByte(ByVal doubleVal As Double)
Dim byteVal As Byte = 0

' Double to Byte conversion can overflow.
Try
byteVal = System.Convert.ToByte(doubleVal)
System.Console.WriteLine("{0} as a Byte is: {1}.", _
doubleVal, byteVal)
Catch exception As System.OverflowException
System.Console.WriteLine( _
"Overflow in Double-to-Byte conversion.")
End Try

' Byte to Double conversion cannot overflow.
doubleVal = System.Convert.ToDouble(byteVal)
System.Console.WriteLine("{0} as a Double is: {1}.", _
byteVal, doubleVal)
End Sub

[C#]
public void ConvertDoubleByte(double doubleVal) {
byte    byteVal = 0;

// Double to byte conversion can overflow.
try {
byteVal = System.Convert.ToByte(doubleVal);
System.Console.WriteLine("{0} as a byte is: {1}.",
doubleVal, byteVal);
}
catch (System.OverflowException) {
System.Console.WriteLine(
"Overflow in double-to-byte conversion.");
}

// Byte to double conversion cannot overflow.
doubleVal = System.Convert.ToDouble(byteVal);
System.Console.WriteLine("{0} as a double is: {1}.",
byteVal, doubleVal);
}

[C++]

void ConvertDoubleByte(double doubleVal)
{
Byte byteVal = 0;

// Double to Byte conversion can overflow.
try {
byteVal = System::Convert::ToByte(doubleVal);
System::Console::WriteLine(S" {0} as a Byte is: {1}.",
__box(doubleVal), __box(byteVal));
} catch (System::OverflowException*) {
System::Console::WriteLine(S"Overflow in double-to-Byte conversion.");
}

// Byte to double conversion cannot overflow.
doubleVal = System::Convert::ToDouble(byteVal);
System::Console::WriteLine(S" {0} as a double is: {1}.",
__box(byteVal), __box(doubleVal));
}
```

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button in the upper-left corner of the page.

#### Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard