C# Convert ToDecimal(Byte)
Description
Convert ToDecimal(Byte)
converts the value of the specified
8-bit unsigned integer to the equivalent decimal number.
Syntax
Convert.ToDecimal(Byte)
has the following syntax.
public static decimal ToDecimal(
byte value
)
Parameters
Convert.ToDecimal(Byte)
has the following parameters.
value
- The 8-bit unsigned integer to convert.
Returns
Convert.ToDecimal(Byte)
method returns The decimal number that is equivalent to value.
Example
The following example converts a Byte value to a Decimal value.
/*from ww w .j av a 2 s. c o m*/
using System;
public class MainClass
{
public static void Main(String[] argv)
{
decimal decimalVal = 0M;
byte byteVal = 13;
decimalVal = System.Convert.ToDecimal(byteVal);
System.Console.WriteLine("The byte as a decimal is {0}.", decimalVal);
byteVal = System.Convert.ToByte(decimalVal);
System.Console.WriteLine("The Decimal as a byte is {0}.", byteVal);
}
}
The code above generates the following result.