C#中的Decimal.ToUInt64()方法
C#中的Decimal.ToUInt64()方法用于将指定的Decimal的值转换为等效的64位无符号整数。
语法
以下是语法-
public static ulong ToUInt64 (decimal val);
上面的Val是要转换的十进制数。
示例
现在让我们看一个实现Decimal.ToUInt64()方法的示例-
using System;
public class Demo {
public static void Main(){
Decimal val = 99.29m;
Console.WriteLine("Decimal value = "+val);
ulong res = Decimal.ToUInt64(val);
Console.WriteLine("64-bit unsigned integer = "+res);
}
}输出结果
这将产生以下输出-
Decimal value = 99.29 64-bit unsigned integer = 99
示例
现在让我们来看另一个示例,以实现Decimal.ToUInt64()方法-
using System;
public class Demo {
public static void Main(){
Decimal val = 0.001m;
Console.WriteLine("Decimal value = "+val);
ulong res = Decimal.ToUInt64(val);
Console.WriteLine("64-bit unsigned integer = "+res);
}
}输出结果
这将产生以下输出-
Decimal value = 0.001 64-bit unsigned integer = 0
热门推荐
10 订婚新发言简短祝福语
11 祝福语怎么写大全简短
12 女儿生日祝福语说说简短
13 他舅生日祝福语简短
14 股市祝福语简短10字
15 中考祝福语简短卡片大全
16 幼师春节祝福语简短创意
17 娃娃考试祝福语幽默简短
18 生日果酒祝福语简短独特