I'm trying to create an array of byte
s whose length is UInt32.MaxValue
. This array is essentially a small(ish) in-memory database:
byte[] countryCodes = new byte[UInt32.MaxValue];
On my machine, however, at run-time, I get a System.OverflowException
with "Arithmetic operation resulted in an overflow".
What's the deal? Do I need to use an unsafe
block and malloc
? How would I do that in C#?