The ulong type represents a 64-bit unsigned integer i.e. UInt64.
To implicitly convert a 64-bit unsigned integer to a Decimal, firstly set UInt64 value.
ulong val = ulong.MaxValue;
To convert ulong to decimal, assign the value.
decimal dec; dec = val;
Let us see the above example.
Example
using System;
public class Demo {
public static void Main() {
ulong val = ulong.MaxValue;
decimal dec;
Console.WriteLine("Implicit conversion from Ulong to Decimal");
dec = val;
Console.WriteLine("Decimal : "+dec);
}
}Output
Implicit conversion from Ulong to Decimal Decimal : 18446744073709551615