C#中的Double.GetTypeCode()方法用于返回值类型Double的TypeCode。
语法如下-
public TypeCode GetTypeCode ();
现在让我们看一个例子-
using System; public class Demo { public static void Main() { double d = 15d; Console.WriteLine("Double Value = "+d); Console.WriteLine("HashCode of Double Value = "+d.GetHashCode()); TypeCode type = d.GetTypeCode(); Console.WriteLine("TypeCode of Double Value = "+type); } }
输出结果
这将产生以下输出-
Double Value = 15 HashCode of Double Value = 1076756480 TypeCode of Double Value = Double
现在让我们来看另一个示例-
using System; public class Demo { public static void Main() { double d = 25.5d; Console.WriteLine("Double Value = "+d); Console.WriteLine("HashCode of Double Value = "+d.GetHashCode()); TypeCode type = d.GetTypeCode(); Console.WriteLine("TypeCode of Double Value = "+type); } }
输出结果
这将产生以下输出-
Double Value = 25.5 HashCode of Double Value = 1077510144 TypeCode of Double Value = Double