Decimal Explicit Conversion (Decimal to Byte)


Defines an explicit conversion of a Decimal to an 8-bit unsigned integer.

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

F# does not support this operator


Type: System.Decimal

The value to convert.

Return Value

Type: System.Byte

An 8-bit unsigned integer that represents the converted Decimal.

Exception Condition

value is less than Byte.MinValue or greater than Byte.MaxValue.

This operator supports the explicit conversion of a Decimal to a Byte. The syntax for such explicit conversions is language-dependent, and individual language compilers can provide different implementations and return different results. The example illustrates the different return values when you explicitly convert a Decimal value to a Byte value by using C#, Visual Basic, and C++. To perform a conversion that is independent of language, you can call the Decimal.ToByte or the Convert.ToByte(Decimal) method.

The following example converts Decimal numbers to Byte values by using the explicit Decimal to Byte conversion.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top