C# Convert ToDecimal(UInt32)
Description
Convert ToDecimal(UInt32)
converts the value of the
specified 32-bit unsigned integer to an equivalent decimal number.
Syntax
Convert.ToDecimal(UInt32)
has the following syntax.
[CLSCompliantAttribute(false)]
public static decimal ToDecimal(
uint value
)
Parameters
Convert.ToDecimal(UInt32)
has the following parameters.
value
- The 32-bit unsigned integer to convert.
Returns
Convert.ToDecimal(UInt32)
method returns A decimal number that is equivalent to value.
Example
The following example converts an array of unsigned integers to Decimal values.
/*w ww.j a v a 2s . co m*/
using System;
public class MainClass{
public static void Main(String[] argv){
uint[] numbers = { UInt32.MinValue, 121, 12345, UInt32.MaxValue };
decimal result;
foreach (uint number in numbers)
{
result = Convert.ToDecimal(number);
Console.WriteLine("Converted the UInt32 value {0} to {1}.",
number, result);
}
}
}
The code above generates the following result.