# Decimal Implicit Conversion (Byte to Decimal)

Converts an 8-bit unsigned integer to a Decimal.

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

## Syntax

```public static implicit operator decimal (
byte value
)
```

#### Parameters

value
Type: System.Byte
An 8-bit unsigned integer.

#### Return Value

Type: System.Decimal
A Decimal that represents the converted 8-bit unsigned integer.

## Examples

The following code example converts Byte values to Decimal numbers using the Byte to Decimal conversion. This conversion is implicit in C#, but requires the op_Implicit operator in Visual Basic and C++. Implicit conversions to Decimal use other methods in these languages.

```
// Example of the implicit conversion from byte to decimal.
using System;

class Example
{
const string formatter =
"{0,15}{1,15}{2,10:X8}{3,9:X8}{4,9:X8}{5,9:X8}";

// Convert the byte argument and display the decimal value.
public static void DecimalFromByte(System.Windows.Controls.TextBlock outputBlock, byte argument)
{
decimal decValue;
int[] bits;

// Display the decimal and its binary representation.
decValue = argument;
bits = decimal.GetBits(decValue);

outputBlock.Text += String.Format(formatter, argument, decValue,
bits[3], bits[2], bits[1], bits[0]) + "\n";
}

public static void Demo(System.Windows.Controls.TextBlock outputBlock)
{
outputBlock.Text += String.Format(
"This example of the implicit conversion from byte " +
"to decimal generates the \nfollowing output. It " +
"displays the decimal value and its binary " +
"representation.\n") + "\n";
outputBlock.Text += String.Format(formatter, "byte argument",
"decimal value", "bits[3]", "bits[2]",
"bits[1]", "bits[0]") + "\n";
outputBlock.Text += String.Format(formatter, "-------------",
"-------------", "-------", "-------",
"-------", "-------") + "\n";

// Convert byte values and display the results.
DecimalFromByte(outputBlock, byte.MinValue);
DecimalFromByte(outputBlock, byte.MaxValue);
DecimalFromByte(outputBlock, 0x3F);
DecimalFromByte(outputBlock, 123);
DecimalFromByte(outputBlock, 200);
}
}

/*
This example of the implicit conversion from byte to decimal generates the
following output. It displays the decimal value and its binary representation.

byte argument  decimal value   bits[3]  bits[2]  bits[1]  bits[0]
-------------  -------------   -------  -------  -------  -------
0              0  00000000 00000000 00000000 00000000
255            255  00000000 00000000 00000000 000000FF
63             63  00000000 00000000 00000000 0000003F
123            123  00000000 00000000 00000000 0000007B
200            200  00000000 00000000 00000000 000000C8
*/

```

## Version Information

#### Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone