C# – sizeof(int) on x64

64-bitc++clrsizeof

When I do sizeof(int) in my C#.NET project I get a return value of 4. I set the project type to x64, so why does it say 4 instead of 8? Is this because I'm running managed code?

Best Solution

The keyword int aliases System.Int32 which still requires 4 bytes, even on a 64-bit machine.