Minnt属性或UInt64 Struct的字段用于表示64位无符号长整数(即ulong数据类型)的最小可能值。该字段的值是常数,表示用户无法更改该字段的值。该字段的值为0 。这样可以防止在运行时发生OverflowException。
句法:
public const ulong MinValue = 0;
返回值:该字段始终返回0。
例子:
// C# program to illustrate the
// UInt64.MinValue Field
using System;
class GFG {
// Main Method
static public void Main()
{
// display the Minimum
// value of UInt64 struct
Console.WriteLine("Minimum Value is: " + UInt64.MinValue);
// taking a variable
ulong var1 = 2382373544;
if (var1.Equals(UInt64.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: 0
Not equal..!!
Type of var1 is: UInt64
参考:
- https://docs.microsoft.com/zh-cn/dotnet/api/system.uint64.minvalue?view=netstandard-2.1