编译器错误 CS1021Compiler Error CS1021

整数常量太大Integral constant is too large

由整数文本表示的值大于UInt64.MaxValueA value represented by an integer literal is greater than UInt64.MaxValue.

下面的示例生成 CS1021:The following sample generates CS1021:

// CS1021.cs  
class Program
{
    static void Main(string[] args)
    {
        int a = 18_446_744_073_709_552_000;
    }
}  

以下代码还生成 CS1021:The following code also generates CS1021:

using System.Numerics;

class Program
{
    static void Main(string[] args)
    {
        var a = new BigInteger(18_446_744_073_709_552_000);
    }
}

有关如何实例化其值超过内置数值类型范围System.Numerics.BigInteger的实例的信息,请参阅BigInteger引用页中的"实例化对象"部分。For information about how to instantiate a System.Numerics.BigInteger instance whose value exceeds the range of the built-in numeric types, see the Instantiating a BigInteger Object section of the BigInteger reference page.