获取C#中当前Decimal实例的哈希码
要获取当前Decimal实例的哈希码,代码如下-
示例
using System;public class Demo {
public static void Main(){
Decimal val = 135269.38193M;
Console.WriteLine("Decimal Value = {0}", val);
Console.WriteLine("HashCode = {0}", (val.GetHashCode()) );
}
}
输出结果
这将产生以下输出-
Decimal Value = 135269.38193HashCode = 1328665595
示例
现在让我们来看另一个示例-
using System;public class Demo {
public static void Main(){
Decimal val = Decimal.MaxValue;
Console.WriteLine("Decimal Value = {0}", val);
Console.WriteLine("HashCode = {0}", (val.GetHashCode()) );
}
}
输出结果
这将产生以下输出-
Decimal Value = 79228162514264337593543950335HashCode = 1173356544
以上是 获取C#中当前Decimal实例的哈希码 的全部内容, 来源链接: utcz.com/z/322169.html