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 r
An Int32
is 4 bytes on x86 and x64. An Int64
is 8 bytes either case. The C# int
type is just an alias for System.Int32
. Same under both runtime environments. The only type that does change depending on the runtime environment is an IntPtr
:
unsafe
{
var size = sizeof(IntPtr); // 4 on x86 bit machines. 8 on x64
}