当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。