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#?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…