Double.GetTypeCode()方法用於返回值類型Double的TypeCode。
用法: public TypeCode GetTypeCode ();
返回值:此方法返回枚舉常量Double。
下麵的程序說明Double.GetTypeCode()方法的使用:
示例1:
// C# program to demonstrate the
// Double.GetTypeCode()
// Method
using System;
using System.Globalization;
class GFG {
// Main Method
public static void Main()
{
// Declaring and initializing value1
double value1 = 10d;
// getting the typeCode
// using GetTypeCode() method
TypeCode value = value1.GetTypeCode();
// Display the TypeCode
Console.WriteLine("TypeCode is {0}", value);
}
}
輸出:
TypeCode is Double
示例2:
// C# program to demonstrate the
// Double.GetTypeCode()
// Method
using System;
using System.Globalization;
class GFG {
// Main Method
public static void Main()
{
// calling get() method
get(5d);
get(5.5d);
get(10d);
get(7.5d);
}
// defining get() method
public static void get(double value1)
{
// getting the TypeCode
// using GetTypeCode() method
TypeCode value = value1.GetTypeCode();
// Display the TypeCode
Console.WriteLine("TypeCode is {0}", value);
}
}
輸出:
TypeCode is Double TypeCode is Double TypeCode is Double TypeCode is Double
參考:
相關用法
- C# Uri.IsBaseOf(Uri)用法及代碼示例
- C# Random.Next()用法及代碼示例
- C# Uri.ToString()用法及代碼示例
- C# Uri.IsWellFormedOriginalString()用法及代碼示例
- C# Uri.GetHashCode()用法及代碼示例
- C# Math.Log()用法及代碼示例
- C# Uri.FromHex()用法及代碼示例
- C# Uri.IsHexDigit()用法及代碼示例
- C# Queue.Contains()用法及代碼示例
注:本文由純淨天空篩選整理自RohitPrasad3大神的英文原創作品 Double.GetTypeCode() Method in C#。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。