當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


C# Int64.MinValue用法及代碼示例


MinValue屬性或Int64結構的字段用於表示Int64的最小可能值。該字段的值是常量,表示用戶無法更改該字段的值。該字段的值為-9223372036854775808。它的十六進製值為0x8000000000000000。

用法:

public const long MinValue = -9223372036854775808;

返回值:該字段始終返回-9223372036854775808。


例:

// C# program to illustrate the 
// Int64.MinValue Field 
using System; 
  
class GFG { 
      
    // Main Method 
    static public void Main() 
    { 
        // display the Minimum 
        // value of Int64 struct 
        Console.WriteLine("Minimum Value is:"+ 
                               Int64.MinValue); 
          
        // taking a variable                    
        long var1 = -2382373544; 
           
        if(var1.Equals(Int64.MinValue)) 
        { 
            Console.WriteLine("Equal..!!"); 
            Console.WriteLine("Type of var1 is:{0}", 
                                 var1.GetTypeCode()); 
        } 
        else
        { 
            Console.WriteLine("Not equal..!!"); 
            Console.WriteLine("Type of var1 is:{0}", 
                                 var1.GetTypeCode()); 
        } 
    } 
}
輸出:
Minimum Value is:-9223372036854775808
Not equal..!!
Type of var1 is:Int64

參考:



相關用法


注:本文由純淨天空篩選整理自ankita_saini大神的英文原創作品 Int64.MinValue Field in C# with Examples。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。