long类型表示64位有符号整数。
若要将64位带符号整数隐式转换为Decimal,请首先设置一个long值。
long val = 989678876876876;
要将long转换为十进制,请分配值。
dec = val;
让我们看另一个例子-
using System; public class Demo { public static void Main() { long val = 76755565656565; decimal dec; Console.WriteLine("Implicit conversion from 64-bit signed integer (long) to Decimal"); dec = val; Console.WriteLine("Decimal : "+dec); } }
输出结果
Implicit conversion from 64-bit signed integer (long) to Decimal Decimal : 76755565656565