Asked • 07/09/19

UInt64 and "The operation overflows at compile time in checked mode" - CS0220?

This feels like a stupid question, but I can't seem to see the answer. I have an UInt64, which is supposed to have a max value of UInt64.MaxValue 18446744073709551615 However, when I try to assign a modest-sized number, I get this overflow error of "The operation overflows at compile time in checked mode". If I wrap it in an "unchecked" block then it compiles, and runs as if this variable is zero: UInt64 value1 = 1073741824 * 8; // Compile error CS0220 UInt64 value2 = 8589934592; // Actual value - no error Why is this happenning?

1 Expert Answer


Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.