我正在尝试创建一个长度为UInt32.MaxValue
的byte
数组。这个数组本质上是一个小型的内存数据库:
byte[] countryCodes = new byte[UInt32.MaxValue];
然而在我的电脑上,运行时我遇到了一个 "Arithmetic operation resulted in an overflow" 的 System.OverflowException
异常。
这是怎么回事呢?我需要使用 unsafe
块和 malloc
吗?在C#中我该怎么做?